修复startSendRtp接口gop缓存功能可能失效的问题 (#2455)

如果帧序列为SPS PPS SEI IDR,那么GOP缓存会从IDR开始,导致解码器未获取到SPS PPS从而不能秒开
This commit is contained in:
Kiki 2023-05-18 16:35:54 +08:00 committed by GitHub
parent 15e76293d0
commit 7e4010df83
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -327,7 +327,6 @@ EventPoller::Ptr MultiMediaSourceMuxer::getOwnerPoller(MediaSource &sender) {
}
bool MultiMediaSourceMuxer::onTrackReady(const Track::Ptr &track) {
bool ret = false;
if (_rtmp) {
ret = _rtmp->addTrack(track) ? true : ret;
@ -471,7 +470,9 @@ bool MultiMediaSourceMuxer::onTrackFrame(const Frame::Ptr &frame_in) {
// 视频时遇到第一帧配置帧或关键帧则标记为gop开始处
auto video_key_pos = frame->keyFrame() || frame->configFrame();
_ring->write(frame, video_key_pos && !_video_key_pos);
_video_key_pos = video_key_pos;
if (!frame->dropAble()) {
_video_key_pos = video_key_pos;
}
} else {
// 没有视频时设置is_key为true目的是关闭gop缓存
_ring->write(frame, !haveVideo());