59 lines
2.3 KiB
Diff
59 lines
2.3 KiB
Diff
From c08682eda2d03bec1648cf5c779241ac0f14cde3 Mon Sep 17 00:00:00 2001
|
|
From: =?UTF-8?q?Robert-Andr=C3=A9=20Mauchin?= <zebob.m@gmail.com>
|
|
Date: Sat, 11 May 2024 19:11:07 +0200
|
|
Subject: [PATCH] Add compatibility with FFMPEG 7.0
|
|
|
|
avutil: remove deprecated FF_API_REORDERED_OPAQUE
|
|
|
|
Ref: https://github.com/FFmpeg/FFmpeg/commit/67e7f0b05eeee37eee1357769038270fda08fe32
|
|
---
|
|
.../video_coding/codecs/h264/h264_decoder_impl.cc | 9 +++++++++
|
|
1 file changed, 9 insertions(+)
|
|
|
|
diff --git a/src/modules/video_coding/codecs/h264/h264_decoder_impl.cc b/src/modules/video_coding/codecs/h264/h264_decoder_impl.cc
|
|
index 76d04e418..bc3917c52 100644
|
|
--- a/src/modules/video_coding/codecs/h264/h264_decoder_impl.cc
|
|
+++ b/src/modules/video_coding/codecs/h264/h264_decoder_impl.cc
|
|
@@ -14,6 +14,9 @@
|
|
// #ifdef unless needed and tested.
|
|
#ifdef WEBRTC_USE_H264
|
|
|
|
+#define HAVE_FFMPEG_REORDERED_OPAQUE (LIBAVFORMAT_VERSION_INT < \
|
|
+ AV_VERSION_INT(59, 8, 100))
|
|
+
|
|
#include "modules/video_coding/codecs/h264/h264_decoder_impl.h"
|
|
|
|
#include <algorithm>
|
|
@@ -212,7 +215,9 @@ int H264DecoderImpl::AVGetBuffer2(AVCodecContext* context,
|
|
int total_size = y_size + 2 * uv_size;
|
|
|
|
av_frame->format = context->pix_fmt;
|
|
+#if HAVE_FFMPEG_REORDERED_OPAQUE
|
|
av_frame->reordered_opaque = context->reordered_opaque;
|
|
+#endif
|
|
|
|
// Create a VideoFrame object, to keep a reference to the buffer.
|
|
// TODO(nisse): The VideoFrame's timestamp and rotation info is not used.
|
|
@@ -361,7 +366,9 @@ int32_t H264DecoderImpl::Decode(const EncodedImage& input_image,
|
|
}
|
|
packet->size = static_cast<int>(input_image.size());
|
|
int64_t frame_timestamp_us = input_image.ntp_time_ms_ * 1000; // ms -> μs
|
|
+#if HAVE_FFMPEG_REORDERED_OPAQUE
|
|
av_context_->reordered_opaque = frame_timestamp_us;
|
|
+#endif
|
|
|
|
int result = avcodec_send_packet(av_context_.get(), packet.get());
|
|
|
|
@@ -378,9 +385,11 @@ int32_t H264DecoderImpl::Decode(const EncodedImage& input_image,
|
|
return WEBRTC_VIDEO_CODEC_ERROR;
|
|
}
|
|
|
|
+#if HAVE_FFMPEG_REORDERED_OPAQUE
|
|
// We don't expect reordering. Decoded frame timestamp should match
|
|
// the input one.
|
|
RTC_DCHECK_EQ(av_frame_->reordered_opaque, frame_timestamp_us);
|
|
+#endif
|
|
|
|
// TODO(sakal): Maybe it is possible to get QP directly from FFmpeg.
|
|
h264_bitstream_parser_.ParseBitstream(input_image);
|