srs gop缓冲

本文通过源码分析,深入探讨SRS服务器在处理Gop缓冲时的具体流程,尤其是在src/app/srs_app_source.cpp中的实现细节,并通过断点调试揭示数据Gop在缓冲过程中的关键步骤。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

源码在 src/app/srs_app_source.cpp中

**
* cache a gop of video/audio data,
* delivery at the connect of flash player,
* to enable it to fast startup.
*/
class SrsGopCache
{
private:
    /**
    * if disabled the gop cache,
    * the client will wait for the next keyframe for h264,
    * and will be black-screen.
    */
    bool enable_gop_cache;
    /**
    * the video frame count, avoid cache for pure audio stream.
    */
    int cached_video_count;
    /**
    * when user disabled video when publishing, and gop cache enalbed,
    * we will cache the audio/video for we already got video, but we never
    * know when to clear the gop cache, for there is no video in future,
    * so we must guess whether user disabled the video.
    * 
# main config for srs. # @see full.conf for detail config. listen 1936; max_connections 1000; srs_log_tank console; srs_log_file ./objs/srs.log; daemon on; #srs_log_tank console; http_api { enabled on; listen 1985; } http_server { enabled on; listen 8080; dir ./objs/nginx/html; } rtc_server { enabled on; listen 8000; # UDP port # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#config-candidate candidate 121.43.231.156; #开启TWCC拥塞控制 twcc_enabled on; #降低NACK重传间隔 nack_enabled on; nack_age_ms 20; } vhost __defaultVhost__ { #转码配置 1080p – 720p #测试不进行转码的延迟 transcode { enabled off; } #HLS切片生成配置 hls { enabled on; hls_fragment 3; #切片时长(秒) hls_window 30; #保留切片总时长(秒) hls_path ./objs/nginx/html/hls; #切存储路径 hls_m3u8_file [app]/[stream].m3u8; hls_ts_file [app]/[stream]-[seq].ts; hls_cleanup on; #自动清理旧切片 } http_remux { enabled on; mount [vhost]/[app]/[stream].flv; } rtc { enabled on; # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtmp-to-rtc rtmp_to_rtc on; # @see https://ossrs.net/lts/zh-cn/docs/v4/doc/webrtc#rtc-to-rtmp rtc_to_rtmp off; #关闭反向转换 #设置更积极的抖动缓冲 jitterbuffer_enabled on; jitterbuffer_fast_mode on; jitterbuffer_delay 50; } tcp_nodelay on; min_latency on; play { gop_cache off; #关闭GOP缓存 queue_length 1; #减少队列长度 3-1 mw_latency 20; #降低最小等待延迟50-20 #开启零缓冲模式 send_min_interval 0; atc off; } publish { mr off; #缩短合帧时间; gop_align off; #减低编缓存 plst_pkt_timeout 200; publish_lstpkt_timeout 200; } }srs.conf配置出现了错误,当值srs服务无法正常启动
最新发布
03-16
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

致一

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值