优化GOP相关逻辑

This commit is contained in:
xiongziliang
2020-01-20 16:22:25 +08:00
parent f453668683
commit f5187e8b0d
6 changed files with 12 additions and 9 deletions

View File

@@ -46,6 +46,7 @@
#include "Thread/ThreadPool.h"
using namespace toolkit;
#define RTMP_GOP_SIZE 512
namespace mediakit {
/**
@@ -70,7 +71,7 @@ public:
RtmpMediaSource(const string &vhost,
const string &app,
const string &stream_id,
int ring_size = 0) :
int ring_size = RTMP_GOP_SIZE) :
MediaSource(RTMP_SCHEMA, vhost, app, stream_id), _ring_size(ring_size) {
}
@@ -146,7 +147,7 @@ public:
//rtmp包缓存最大允许512个如果是纯视频(25fps)大概为20秒数据
//但是这个是GOP缓存的上限值真实的GOP缓存大小等于两个I帧之间的包数的两倍
//而且每次遇到I帧则会清空GOP缓存所以真实的GOP缓存远小于此值
_ring = std::make_shared<RingType>(_ring_size,512,std::move(lam));
_ring = std::make_shared<RingType>(_ring_size,std::move(lam));
onReaderChanged(0);
if(_metadata){