srs开源流媒体服务器中gop_cash是如何实现的?

本文详细探讨了SRS流媒体服务器中GOP Cache的工作原理和设置,包括如何开启和关闭GOP Cache,设置缓存时间,服务器如何识别关键帧,以及如何处理音频和视频的同步。此外,还解释了客户端连接时GOP Cache的发送机制和其作用。

要解决几个问题:

    (1)srs服务器gop_cache如何打开和关闭?

    (2)gop_cache缓存时间如何设置?

    (3)服务器如何知道某个msg是gop_cache的关键帧,并且清理前面的帧。

    (4)audio和video的gop_cache如何对应起来(同步)?

    (5)客户端连入的时候如何把gop_cache发给客户端。

    (6)gop_cache有何用?

(1)服务器gop_cache如何打开和关闭?

    其实很简单,如下conf配置上加 gop_cache on/off; 即可

# the listen ports, split by space.
listen              1935;
vhost __defaultVhost__ {
    # whether cache the last gop.
    # if on, cache the last gop and dispatch to client,
    #   to enable fast startup for client, client play immediately.
    # if off, send the latest media data to client,
    #   client need to wait for the next Iframe to decode and show the video.
    # set to off if requires min delay;
    # set to on if requires client fast startup.
    # default: on
    gop_cache       on;
}

     参考这里:

     https://github.com/ossrs/srs/wiki/v2_CN_LowLatency#gop-cache

(2)gop_cache缓存时间如何设置?

     gop_cache的时间间隔是推流的客户端决定的,跟服务器没关系。

     比如:

     A.基于ffmpeg实现的客户端设置可以参考如下代码,如下代码把gop_size设置为帧率大小,换算成

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值