From 6c3d362b5a569ec9e7054cda320fe953ff14aaf8 Mon Sep 17 00:00:00 2001 From: zhang2349 Date: Fri, 5 Jul 2024 20:55:36 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3finish=E6=98=AFtrue=E4=BD=86t?= =?UTF-8?q?rack=E4=B8=8D=E6=94=AF=E6=8C=81=EF=BC=8C=E6=B2=A1=E6=9C=89?= =?UTF-8?q?=E6=89=A7=E8=A1=8CaddTrackCompleted=E7=9A=84=E9=97=AE=E9=A2=98?= =?UTF-8?q?=20(#3689)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 加快track类型不支持时媒体的注册速度 --- src/Rtp/Decoder.cpp | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/src/Rtp/Decoder.cpp b/src/Rtp/Decoder.cpp index ca4b20b7..778541a9 100644 --- a/src/Rtp/Decoder.cpp +++ b/src/Rtp/Decoder.cpp @@ -87,10 +87,9 @@ DecoderImp::DecoderImp(const Decoder::Ptr &decoder, MediaSinkInterface *sink){ void DecoderImp::onStream(int stream, int codecid, const void *extra, size_t bytes, int finish) { // G711传统只支持 8000/1/16的规格,FFmpeg貌似做了扩展,但是这里不管它了 auto track = Factory::getTrackByCodecId(getCodecByMpegId(codecid), 8000, 1, 16); - if (!track) { - return; + if (track) { + onTrack(stream, std::move(track)); } - onTrack(stream, std::move(track)); // 防止未获取视频track提前complete导致忽略后续视频的问题,用于兼容一些不太规范的ps流 if (finish && _have_video) { _sink->addTrackCompleted();