mirror of
https://github.com/ZLMediaKit/ZLMediaKit.git
synced 2026-06-21 08:13:49 +08:00
rtp级联(ps/ts/es)新增支持gop缓存功能 (#2395)
该修改主要解决rtp级联(调用startSendRtp接口)未做gop缓存导致上级无法秒开的问题。 同时通过RingBuffer对象线程隔离的特性,实现了在断连续推场景下归属线程切换导致的线程安全问题。 用户如未使用rtp级联功能,请修改配置文件关闭GOP缓存(rtp_proxy.gop_cache=0)以便节省内存。 --------- Co-authored-by: 夏楚 <771730766@qq.com>
This commit is contained in:
@@ -20,14 +20,6 @@ RtpCache::RtpCache(onFlushed cb) {
|
||||
_cb = std::move(cb);
|
||||
}
|
||||
|
||||
bool RtpCache::firstKeyReady(bool in) {
|
||||
if (_first_key) {
|
||||
return _first_key;
|
||||
}
|
||||
_first_key = in;
|
||||
return _first_key;
|
||||
}
|
||||
|
||||
void RtpCache::onFlush(std::shared_ptr<List<Buffer::Ptr>> rtp_list, bool) {
|
||||
_cb(std::move(rtp_list));
|
||||
}
|
||||
@@ -42,9 +34,6 @@ void RtpCachePS::flush() {
|
||||
}
|
||||
|
||||
void RtpCachePS::onRTP(Buffer::Ptr buffer, bool is_key) {
|
||||
if (!firstKeyReady(is_key)) {
|
||||
return;
|
||||
}
|
||||
auto rtp = std::static_pointer_cast<RtpPacket>(buffer);
|
||||
auto stamp = rtp->getStampMS();
|
||||
input(stamp, std::move(buffer), is_key);
|
||||
@@ -56,9 +45,6 @@ void RtpCacheRaw::flush() {
|
||||
}
|
||||
|
||||
void RtpCacheRaw::onRTP(Buffer::Ptr buffer, bool is_key) {
|
||||
if (!firstKeyReady(is_key)) {
|
||||
return;
|
||||
}
|
||||
auto rtp = std::static_pointer_cast<RtpPacket>(buffer);
|
||||
auto stamp = rtp->getStampMS();
|
||||
input(stamp, std::move(buffer), is_key);
|
||||
|
||||
Reference in New Issue
Block a user