From ba1a88f202f1b9629ead0b8720c5183993835b9d Mon Sep 17 00:00:00 2001 From: xiongguangjie Date: Sat, 10 Aug 2024 11:09:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8Dffmpeg5=E4=BB=A5=E4=B8=8A?= =?UTF-8?q?=E9=BB=98=E8=AE=A4=E4=B8=8D=E5=90=88=E5=B9=B6=E5=B8=A7=E5=AF=BC?= =?UTF-8?q?=E8=87=B4=E8=A7=A3=E7=A0=81=E5=A4=B1=E8=B4=A5=E7=9A=84bug=20(#3?= =?UTF-8?q?809=20#3794)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit FFmpegDecoder 默认合并帧,ffmpeg 5以上不支持将不完整的帧送入解码器中,根据 issue #3794 做出修改 --- src/Codec/Transcode.cpp | 1 + src/Codec/Transcode.h | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Codec/Transcode.cpp b/src/Codec/Transcode.cpp index daffe5ac..8c07b9b2 100644 --- a/src/Codec/Transcode.cpp +++ b/src/Codec/Transcode.cpp @@ -439,6 +439,7 @@ FFmpegDecoder::FFmpegDecoder(const Track::Ptr &track, int thread_num, const std: if (codec->capabilities & AV_CODEC_CAP_TRUNCATED) { /* we do not send complete frames */ _context->flags |= AV_CODEC_FLAG_TRUNCATED; + _do_merger = false; } else { // 此时业务层应该需要合帧 _do_merger = true; diff --git a/src/Codec/Transcode.h b/src/Codec/Transcode.h index 4cfaee62..f5b148c7 100644 --- a/src/Codec/Transcode.h +++ b/src/Codec/Transcode.h @@ -114,7 +114,8 @@ private: bool decodeFrame(const char *data, size_t size, uint64_t dts, uint64_t pts, bool live, bool key_frame); private: - bool _do_merger = false; + // default merge frame + bool _do_merger = true; toolkit::Ticker _ticker; onDec _cb; std::shared_ptr _context;