重写GOP缓存机制

This commit is contained in:
xiongziliang 2020-01-15 11:07:55 +08:00
parent 0a4b59031f
commit 444137e5b7
3 changed files with 10 additions and 3 deletions

@ -1 +1 @@
Subproject commit a6b41db987aa2633762fd06e809e0fdb7d60fef0 Subproject commit 3b5165043d4b40061b7dfcd9800691ab45e167c7

View File

@ -142,7 +142,11 @@ public:
} }
strongSelf->onReaderChanged(size); strongSelf->onReaderChanged(size);
}; };
_ring = std::make_shared<RingType>(_ring_size, std::move(lam));
//rtmp包缓存最大允许512个如果是纯视频(25fps)大概为20秒数据
//但是这个是GOP缓存的上限值真实的GOP缓存大小等于两个I帧之间的包数的两倍
//而且每次遇到I帧则会清空GOP缓存所以真实的GOP缓存远小于此值
_ring = std::make_shared<RingType>(_ring_size,512,std::move(lam));
onReaderChanged(0); onReaderChanged(0);
if(_metadata){ if(_metadata){

View File

@ -179,7 +179,10 @@ public:
} }
strongSelf->onReaderChanged(size); strongSelf->onReaderChanged(size);
}; };
_ring = std::make_shared<RingType>(_ring_size, std::move(lam)); //rtp包缓存最大允许2048个大概最多3MB数据
//但是这个是GOP缓存的上限值真实的GOP缓存大小等于两个I帧之间的包数的两倍
//而且每次遇到I帧则会清空GOP缓存所以真实的GOP缓存远小于此值
_ring = std::make_shared<RingType>(_ring_size,2048, std::move(lam));
onReaderChanged(0); onReaderChanged(0);
if (!_sdp.empty()) { if (!_sdp.empty()) {
regist(); regist();