git: f78c1003e0ee - main - www/qt5-webengine: Fix build with FFmpeg 8.x

From: Jason E. Hale <jhale_at_FreeBSD.org>
Date: Sun, 28 Dec 2025 07:03:24 UTC
The branch main has been updated by jhale:

URL: https://cgit.FreeBSD.org/ports/commit/?id=f78c1003e0ee297011f3e1b41634377c827c8113

commit f78c1003e0ee297011f3e1b41634377c827c8113
Author:     Jason E. Hale <jhale@FreeBSD.org>
AuthorDate: 2025-12-28 07:00:55 +0000
Commit:     Jason E. Hale <jhale@FreeBSD.org>
CommitDate: 2025-12-28 07:03:00 +0000

    www/qt5-webengine: Fix build with FFmpeg 8.x
    
    Reported by:    pkg-fallout
---
 ...support-for-ffmpeg5-and-later => patch-ffmpeg5} |  66 +--
 www/qt5-webengine/files/patch-ffmpeg7              | 497 +++++++++++++++++++++
 www/qt5-webengine/files/patch-ffmpeg8              | 215 +++++++++
 3 files changed, 750 insertions(+), 28 deletions(-)

diff --git a/www/qt5-webengine/files/patch-add-support-for-ffmpeg5-and-later b/www/qt5-webengine/files/patch-ffmpeg5
similarity index 72%
rename from www/qt5-webengine/files/patch-add-support-for-ffmpeg5-and-later
rename to www/qt5-webengine/files/patch-ffmpeg5
index de6185aba53d..fc994bd8eac7 100644
--- a/www/qt5-webengine/files/patch-add-support-for-ffmpeg5-and-later
+++ b/www/qt5-webengine/files/patch-ffmpeg5
@@ -1,10 +1,6 @@
-Adds support for FFmpeg and later
-
-Obtained from:
-
-https://github.com/archlinux/svntogit-packages/blob/packages/qt5-webengine/trunk/qt5-webengine-ffmpeg5.patch
-
---- src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.h.orig	2021-12-15 16:12:54 UTC
+diff --git a/chromium/media/ffmpeg/ffmpeg_common.h b/chromium/media/ffmpeg/ffmpeg_common.h
+index 2734a485cbd..70b1877a43c 100644
+--- src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.h
 +++ src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.h
 @@ -29,6 +29,7 @@ extern "C" {
  #include <libavformat/avformat.h>
@@ -14,9 +10,11 @@ https://github.com/archlinux/svntogit-packages/blob/packages/qt5-webengine/trunk
  #include <libavutil/imgutils.h>
  #include <libavutil/log.h>
  #include <libavutil/mastering_display_metadata.h>
---- src/3rdparty/chromium/media/filters/audio_file_reader.cc.orig	2021-12-15 16:12:54 UTC
+diff --git a/chromium/media/filters/audio_file_reader.cc b/chromium/media/filters/audio_file_reader.cc
+index cb81d920def..bd73908d0ca 100644
+--- src/3rdparty/chromium/media/filters/audio_file_reader.cc
 +++ src/3rdparty/chromium/media/filters/audio_file_reader.cc
-@@ -85,7 +85,7 @@ bool AudioFileReader::OpenDecoder() {
+@@ -85,7 +85,7 @@ bool AudioFileReader::OpenDemuxer() {
  }
  
  bool AudioFileReader::OpenDecoder() {
@@ -25,9 +23,11 @@ https://github.com/archlinux/svntogit-packages/blob/packages/qt5-webengine/trunk
    if (codec) {
      // MP3 decodes to S16P which we don't support, tell it to use S16 instead.
      if (codec_context_->sample_fmt == AV_SAMPLE_FMT_S16P)
---- src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc.orig	2021-12-15 16:12:54 UTC
+diff --git a/chromium/media/filters/ffmpeg_audio_decoder.cc b/chromium/media/filters/ffmpeg_audio_decoder.cc
+index 0d825ed791b..72fac6167ef 100644
+--- src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc
 +++ src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc
-@@ -329,7 +329,7 @@ bool FFmpegAudioDecoder::ConfigureDecoder(const AudioD
+@@ -329,7 +329,7 @@ bool FFmpegAudioDecoder::ConfigureDecoder(const AudioDecoderConfig& config) {
      }
    }
  
@@ -36,9 +36,11 @@ https://github.com/archlinux/svntogit-packages/blob/packages/qt5-webengine/trunk
    if (!codec ||
        avcodec_open2(codec_context_.get(), codec, &codec_options) < 0) {
      DLOG(ERROR) << "Could not initialize audio decoder: "
---- src/3rdparty/chromium/media/filters/ffmpeg_demuxer.cc.orig	2021-12-15 16:12:54 UTC
+diff --git a/chromium/media/filters/ffmpeg_demuxer.cc b/chromium/media/filters/ffmpeg_demuxer.cc
+index d34db63f3ef..427565b00c1 100644
+--- src/3rdparty/chromium/media/filters/ffmpeg_demuxer.cc
 +++ src/3rdparty/chromium/media/filters/ffmpeg_demuxer.cc
-@@ -98,12 +98,12 @@ static base::TimeDelta ExtractStartTime(AVStream* stre
+@@ -98,12 +98,12 @@ static base::TimeDelta ExtractStartTime(AVStream* stream) {
  
    // Next try to use the first DTS value, for codecs where we know PTS == DTS
    // (excludes all H26x codecs). The start time must be returned in PTS.
@@ -53,7 +55,7 @@ https://github.com/archlinux/svntogit-packages/blob/packages/qt5-webengine/trunk
      if (first_pts < start_time)
        start_time = first_pts;
    }
-@@ -408,11 +408,11 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket
+@@ -408,11 +408,11 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
    scoped_refptr<DecoderBuffer> buffer;
  
    if (type() == DemuxerStream::TEXT) {
@@ -67,7 +69,7 @@ https://github.com/archlinux/svntogit-packages/blob/packages/qt5-webengine/trunk
      uint8_t* settings_data = av_packet_get_side_data(
          packet.get(), AV_PKT_DATA_WEBVTT_SETTINGS, &settings_size);
  
-@@ -424,7 +424,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket
+@@ -424,7 +424,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
      buffer = DecoderBuffer::CopyFrom(packet->data, packet->size,
                                       side_data.data(), side_data.size());
    } else {
@@ -76,7 +78,7 @@ https://github.com/archlinux/svntogit-packages/blob/packages/qt5-webengine/trunk
      uint8_t* side_data = av_packet_get_side_data(
          packet.get(), AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, &side_data_size);
  
-@@ -485,7 +485,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket
+@@ -485,7 +485,7 @@ void FFmpegDemuxerStream::EnqueuePacket(ScopedAVPacket packet) {
                                         packet->size - data_offset);
      }
  
@@ -85,9 +87,11 @@ https://github.com/archlinux/svntogit-packages/blob/packages/qt5-webengine/trunk
      const uint32_t* skip_samples_ptr =
          reinterpret_cast<const uint32_t*>(av_packet_get_side_data(
              packet.get(), AV_PKT_DATA_SKIP_SAMPLES, &skip_samples_size));
---- src/3rdparty/chromium/media/filters/ffmpeg_glue.cc.orig	2021-12-15 16:12:54 UTC
+diff --git a/chromium/media/filters/ffmpeg_glue.cc b/chromium/media/filters/ffmpeg_glue.cc
+index 0ef3521473d..8483ecc348f 100644
+--- src/3rdparty/chromium/media/filters/ffmpeg_glue.cc
 +++ src/3rdparty/chromium/media/filters/ffmpeg_glue.cc
-@@ -59,7 +59,6 @@ void FFmpegGlue::InitializeFFmpeg() {
+@@ -59,7 +59,6 @@ static int64_t AVIOSeekOperation(void* opaque, int64_t offset, int whence) {
  }
  
  void FFmpegGlue::InitializeFFmpeg() {
@@ -95,19 +99,21 @@ https://github.com/archlinux/svntogit-packages/blob/packages/qt5-webengine/trunk
  }
  
  static void LogContainer(bool is_local_file,
-@@ -94,9 +93,6 @@ FFmpegGlue::FFmpegGlue(FFmpegURLProtocol* protocol) {
- 
+@@ -95,9 +94,6 @@ FFmpegGlue::FFmpegGlue(FFmpegURLProtocol* protocol) {
    // Enable fast, but inaccurate seeks for MP3.
    format_context_->flags |= AVFMT_FLAG_FAST_SEEK;
--
+ 
 -  // Ensures we can read out various metadata bits like vp8 alpha.
 -  format_context_->flags |= AVFMT_FLAG_KEEP_SIDE_DATA;
- 
+-
    // Ensures format parsing errors will bail out. From an audit on 11/2017, all
    // instances were real failures. Solves bugs like http://crbug.com/710791.
---- src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc.orig	2021-12-15 16:12:54 UTC
+   format_context_->error_recognition |= AV_EF_EXPLODE;
+diff --git a/chromium/media/filters/ffmpeg_video_decoder.cc b/chromium/media/filters/ffmpeg_video_decoder.cc
+index ef12477ee89..7996606f5f9 100644
+--- src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc
 +++ src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc
-@@ -391,7 +391,7 @@ bool FFmpegVideoDecoder::ConfigureDecoder(const VideoD
+@@ -391,7 +391,7 @@ bool FFmpegVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config,
    if (decode_nalus_)
      codec_context_->flags2 |= AV_CODEC_FLAG2_CHUNKS;
  
@@ -116,9 +122,11 @@ https://github.com/archlinux/svntogit-packages/blob/packages/qt5-webengine/trunk
    if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
      ReleaseFFmpegResources();
      return false;
---- src/3rdparty/chromium/media/filters/media_file_checker.cc.orig	2021-12-15 16:12:54 UTC
+diff --git a/chromium/media/filters/media_file_checker.cc b/chromium/media/filters/media_file_checker.cc
+index 59c2a2fc618..1a9872c7acb 100644
+--- src/3rdparty/chromium/media/filters/media_file_checker.cc
 +++ src/3rdparty/chromium/media/filters/media_file_checker.cc
-@@ -68,7 +68,7 @@ bool MediaFileChecker::Start(base::TimeDelta check_tim
+@@ -68,7 +68,7 @@ bool MediaFileChecker::Start(base::TimeDelta check_time) {
        auto context = AVStreamToAVCodecContext(format_context->streams[i]);
        if (!context)
          continue;
@@ -127,9 +135,11 @@ https://github.com/archlinux/svntogit-packages/blob/packages/qt5-webengine/trunk
        if (codec && avcodec_open2(context.get(), codec, nullptr) >= 0) {
          auto loop = std::make_unique<FFmpegDecodingLoop>(context.get());
          stream_contexts[i] = {std::move(context), std::move(loop)};
---- src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc.orig	2021-12-15 16:12:54 UTC
+diff --git a/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc b/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc
+index 9002b874611..d12fade8b63 100644
+--- src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc
 +++ src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc
-@@ -203,7 +203,7 @@ int32_t H264DecoderImpl::InitDecode(const VideoCodec* 
+@@ -203,7 +203,7 @@ int32_t H264DecoderImpl::InitDecode(const VideoCodec* codec_settings,
    // a pointer |this|.
    av_context_->opaque = this;
  
diff --git a/www/qt5-webengine/files/patch-ffmpeg7 b/www/qt5-webengine/files/patch-ffmpeg7
new file mode 100644
index 000000000000..8f0d51deb014
--- /dev/null
+++ b/www/qt5-webengine/files/patch-ffmpeg7
@@ -0,0 +1,497 @@
+From 6e554a30893150793c2638e3689cf208ffc8e375 Mon Sep 17 00:00:00 2001
+From: Dale Curtis <dalecurtis@chromium.org>
+Date: Sat, 2 Apr 2022 05:13:53 +0000
+Subject: [PATCH] Roll src/third_party/ffmpeg/ 574c39cce..32b2d1d526 (1125
+ commits)
+
+https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+log/574c39cce323..32b2d1d526
+
+Created with:
+  roll-dep src/third_party/ffmpeg
+
+Fixed: 1293918
+Cq-Include-Trybots: luci.chromium.try:mac_chromium_asan_rel_ng,linux_chromium_asan_rel_ng,linux_chromium_chromeos_asan_rel_ng
+Change-Id: I41945d0f963e3d1f65940067bac22f63b68e37d2
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3565647
+Auto-Submit: Dale Curtis <dalecurtis@chromium.org>
+Reviewed-by: Dan Sanders <sandersd@chromium.org>
+Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
+Cr-Commit-Position: refs/heads/main@{#988253}
+---
+ .../clear_key_cdm/ffmpeg_cdm_audio_decoder.cc | 29 ++++++++++---------
+ media/ffmpeg/ffmpeg_common.cc                 | 11 +++----
+ media/filters/audio_file_reader.cc            |  9 +++---
+ media/filters/audio_file_reader_unittest.cc   |  6 ++--
+ .../filters/audio_video_metadata_extractor.cc | 11 +++++--
+ .../filters/ffmpeg_aac_bitstream_converter.cc |  7 +++--
+ ...ffmpeg_aac_bitstream_converter_unittest.cc |  2 +-
+ media/filters/ffmpeg_audio_decoder.cc         | 13 +++++----
+ 8 files changed, 51 insertions(+), 37 deletions(-)
+
+diff --git a/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc b/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc
+index e4fc3f460e2..9b1ad9f7675 100644
+--- src/3rdparty/chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc
++++ src/3rdparty/chromium/media/cdm/library_cdm/clear_key_cdm/ffmpeg_cdm_audio_decoder.cc
+@@ -74,7 +74,7 @@ void CdmAudioDecoderConfigToAVCodecContext(
+       codec_context->sample_fmt = AV_SAMPLE_FMT_NONE;
+   }
+ 
+-  codec_context->channels = config.channel_count;
++  codec_context->ch_layout.nb_channels = config.channel_count;
+   codec_context->sample_rate = config.samples_per_second;
+ 
+   if (config.extra_data) {
+@@ -124,8 +124,8 @@ void CopySamples(cdm::AudioFormat cdm_format,
+     case cdm::kAudioFormatPlanarS16:
+     case cdm::kAudioFormatPlanarF32: {
+       const int decoded_size_per_channel =
+-          decoded_audio_size / av_frame.channels;
+-      for (int i = 0; i < av_frame.channels; ++i) {
++          decoded_audio_size / av_frame.ch_layout.nb_channels;
++      for (int i = 0; i < av_frame.ch_layout.nb_channels; ++i) {
+         memcpy(output_buffer, av_frame.extended_data[i],
+                decoded_size_per_channel);
+         output_buffer += decoded_size_per_channel;
+@@ -185,13 +185,14 @@ bool FFmpegCdmAudioDecoder::Initialize(
+   // Success!
+   decoding_loop_.reset(new FFmpegDecodingLoop(codec_context_.get()));
+   samples_per_second_ = config.samples_per_second;
+-  bytes_per_frame_ = codec_context_->channels * config.bits_per_channel / 8;
++  bytes_per_frame_ =
++      codec_context_->ch_layout.nb_channels * config.bits_per_channel / 8;
+   output_timestamp_helper_.reset(
+       new AudioTimestampHelper(config.samples_per_second));
+   is_initialized_ = true;
+ 
+   // Store initial values to guard against midstream configuration changes.
+-  channels_ = codec_context_->channels;
++  channels_ = codec_context_->ch_layout.nb_channels;
+   av_sample_format_ = codec_context_->sample_fmt;
+ 
+   return true;
+@@ -291,17 +292,18 @@ cdm::Status FFmpegCdmAudioDecoder::DecodeBuffer(
+   for (auto& frame : audio_frames) {
+     int decoded_audio_size = 0;
+     if (frame->sample_rate != samples_per_second_ ||
+-        frame->channels != channels_ || frame->format != av_sample_format_) {
++        frame->ch_layout.nb_channels != channels_ ||
++        frame->format != av_sample_format_) {
+       DLOG(ERROR) << "Unsupported midstream configuration change!"
+                   << " Sample Rate: " << frame->sample_rate << " vs "
+-                  << samples_per_second_ << ", Channels: " << frame->channels
++                  << samples_per_second_ << ", Channels: " << frame->ch_layout.nb_channels
+                   << " vs " << channels_ << ", Sample Format: " << frame->format
+                   << " vs " << av_sample_format_;
+       return cdm::kDecodeError;
+     }
+ 
+     decoded_audio_size = av_samples_get_buffer_size(
+-        nullptr, codec_context_->channels, frame->nb_samples,
++        nullptr, codec_context_->ch_layout.nb_channels, frame->nb_samples,
+         codec_context_->sample_fmt, 1);
+     if (!decoded_audio_size)
+       continue;
+@@ -320,7 +323,7 @@ bool FFmpegCdmAudioDecoder::OnNewFrame(
+     size_t* total_size,
+     std::vector<std::unique_ptr<AVFrame, ScopedPtrAVFreeFrame>>* audio_frames,
+     AVFrame* frame) {
+-  *total_size += av_samples_get_buffer_size(nullptr, codec_context_->channels,
++  *total_size += av_samples_get_buffer_size(nullptr, codec_context_->ch_layout.nb_channels,
+                                             frame->nb_samples,
+                                             codec_context_->sample_fmt, 1);
+   audio_frames->emplace_back(av_frame_clone(frame));
+diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
+index 87ca8969626..76f03d6608e 100644
+--- src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc
++++ src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc
+@@ -345,10 +345,11 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context,
+       codec_context->sample_fmt, codec_context->codec_id);
+ 
+   ChannelLayout channel_layout =
+-      codec_context->channels > 8
++      codec_context->ch_layout.nb_channels > 8
+           ? CHANNEL_LAYOUT_DISCRETE
+-          : ChannelLayoutToChromeChannelLayout(codec_context->channel_layout,
+-                                               codec_context->channels);
++          : ChannelLayoutToChromeChannelLayout(
++                codec_context->ch_layout.u.mask,
++                codec_context->ch_layout.nb_channels);
+ 
+   int sample_rate = codec_context->sample_rate;
+   switch (codec) {
+@@ -401,7 +402,7 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context,
+                      extra_data, encryption_scheme, seek_preroll,
+                      codec_context->delay);
+   if (channel_layout == CHANNEL_LAYOUT_DISCRETE)
+-    config->SetChannelsForDiscrete(codec_context->channels);
++    config->SetChannelsForDiscrete(codec_context->ch_layout.nb_channels);
+ 
+ #if BUILDFLAG(ENABLE_PLATFORM_AC3_EAC3_AUDIO)
+   // These are bitstream formats unknown to ffmpeg, so they don't have
+@@ -470,7 +471,7 @@ void AudioDecoderConfigToAVCodecContext(const AudioDecoderConfig& config,
+ 
+   // TODO(scherkus): should we set |channel_layout|? I'm not sure if FFmpeg uses
+   // said information to decode.
+-  codec_context->channels = config.channels();
++  codec_context->ch_layout.nb_channels = config.channels();
+   codec_context->sample_rate = config.samples_per_second();
+ 
+   if (config.extra_data().empty()) {
+diff --git a/media/filters/audio_file_reader.cc b/media/filters/audio_file_reader.cc
+index 5f257bdfaa6..e1be5aa9a5b 100644
+--- src/3rdparty/chromium/media/filters/audio_file_reader.cc
++++ src/3rdparty/chromium/media/filters/audio_file_reader.cc
+@@ -113,14 +113,15 @@ bool AudioFileReader::OpenDecoder() {
+ 
+   // Verify the channel layout is supported by Chrome.  Acts as a sanity check
+   // against invalid files.  See http://crbug.com/171962
+-  if (ChannelLayoutToChromeChannelLayout(codec_context_->channel_layout,
+-                                         codec_context_->channels) ==
++  if (ChannelLayoutToChromeChannelLayout(
++          codec_context_->ch_layout.u.mask,
++          codec_context_->ch_layout.nb_channels) ==
+       CHANNEL_LAYOUT_UNSUPPORTED) {
+     return false;
+   }
+ 
+   // Store initial values to guard against midstream configuration changes.
+-  channels_ = codec_context_->channels;
++  channels_ = codec_context_->ch_layout.nb_channels;
+   audio_codec_ = CodecIDToAudioCodec(codec_context_->codec_id);
+   sample_rate_ = codec_context_->sample_rate;
+   av_sample_format_ = codec_context_->sample_fmt;
+@@ -223,7 +224,7 @@ bool AudioFileReader::OnNewFrame(
+   if (frames_read < 0)
+     return false;
+ 
+-  const int channels = frame->channels;
++  const int channels = frame->ch_layout.nb_channels;
+   if (frame->sample_rate != sample_rate_ || channels != channels_ ||
+       frame->format != av_sample_format_) {
+     DLOG(ERROR) << "Unsupported midstream configuration change!"
+diff --git a/media/filters/ffmpeg_aac_bitstream_converter.cc b/media/filters/ffmpeg_aac_bitstream_converter.cc
+index 6f231c85729..ca5e5fb927d 100644
+--- src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc
++++ src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc
+@@ -195,14 +195,15 @@ bool FFmpegAACBitstreamConverter::ConvertPacket(AVPacket* packet) {
+   if (!header_generated_ || codec_ != stream_codec_parameters_->codec_id ||
+       audio_profile_ != stream_codec_parameters_->profile ||
+       sample_rate_index_ != sample_rate_index ||
+-      channel_configuration_ != stream_codec_parameters_->channels ||
++      channel_configuration_ !=
++          stream_codec_parameters_->ch_layout.nb_channels ||
+       frame_length_ != header_plus_packet_size) {
+     header_generated_ =
+         GenerateAdtsHeader(stream_codec_parameters_->codec_id,
+                            0,  // layer
+                            stream_codec_parameters_->profile, sample_rate_index,
+                            0,  // private stream
+-                           stream_codec_parameters_->channels,
++                           stream_codec_parameters_->ch_layout.nb_channels,
+                            0,  // originality
+                            0,  // home
+                            0,  // copyrighted_stream
+@@ -214,7 +215,7 @@ bool FFmpegAACBitstreamConverter::ConvertPacket(AVPacket* packet) {
+     codec_ = stream_codec_parameters_->codec_id;
+     audio_profile_ = stream_codec_parameters_->profile;
+     sample_rate_index_ = sample_rate_index;
+-    channel_configuration_ = stream_codec_parameters_->channels;
++    channel_configuration_ = stream_codec_parameters_->ch_layout.nb_channels;
+     frame_length_ = header_plus_packet_size;
+   }
+ 
+diff --git a/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc b/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc
+index 1fd4c5ccd7d..f59bcd8fdaf 100644
+--- src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc
++++ src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc
+@@ -34,7 +34,7 @@ class FFmpegAACBitstreamConverterTest : public testing::Test {
+     memset(&test_parameters_, 0, sizeof(AVCodecParameters));
+     test_parameters_.codec_id = AV_CODEC_ID_AAC;
+     test_parameters_.profile = FF_PROFILE_AAC_MAIN;
+-    test_parameters_.channels = 2;
++    test_parameters_.ch_layout.nb_channels = 2;
+     test_parameters_.extradata = extradata_header_;
+     test_parameters_.extradata_size = sizeof(extradata_header_);
+   }
+diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc
+index 6a56c675f7d..4615fdeb3fb 100644
+--- src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc
++++ src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc
+@@ -28,7 +28,7 @@ namespace media {
+ 
+ // Return the number of channels from the data in |frame|.
+ static inline int DetermineChannels(AVFrame* frame) {
+-  return frame->channels;
++  return frame->ch_layout.nb_channels;
+ }
+ 
+ // Called by FFmpeg's allocation routine to allocate a buffer. Uses
+@@ -231,7 +231,7 @@ bool FFmpegAudioDecoder::OnNewFrame(const DecoderBuffer& buffer,
+   // Translate unsupported into discrete layouts for discrete configurations;
+   // ffmpeg does not have a labeled discrete configuration internally.
+   ChannelLayout channel_layout = ChannelLayoutToChromeChannelLayout(
+-      codec_context_->channel_layout, codec_context_->channels);
++      codec_context_->ch_layout.u.mask, codec_context_->ch_layout.nb_channels);
+   if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED &&
+       config_.channel_layout() == CHANNEL_LAYOUT_DISCRETE) {
+     channel_layout = CHANNEL_LAYOUT_DISCRETE;
+@@ -348,11 +348,11 @@ bool FFmpegAudioDecoder::ConfigureDecoder(const AudioDecoderConfig& config) {
+   // Success!
+   av_sample_format_ = codec_context_->sample_fmt;
+ 
+-  if (codec_context_->channels != config.channels()) {
++  if (codec_context_->ch_layout.nb_channels != config.channels()) {
+     MEDIA_LOG(ERROR, media_log_)
+         << "Audio configuration specified " << config.channels()
+         << " channels, but FFmpeg thinks the file contains "
+-        << codec_context_->channels << " channels";
++        << codec_context_->ch_layout.nb_channels << " channels";
+     ReleaseFFmpegResources();
+     state_ = DecoderState::kUninitialized;
+     return false;
+@@ -403,7 +403,7 @@ int FFmpegAudioDecoder::GetAudioBuffer(struct AVCodecContext* s,
+   if (frame->nb_samples <= 0)
+     return AVERROR(EINVAL);
+ 
+-  if (s->channels != channels) {
++  if (s->ch_layout.nb_channels != channels) {
+     DLOG(ERROR) << "AVCodecContext and AVFrame disagree on channel count.";
+     return AVERROR(EINVAL);
+   }
+@@ -436,7 +436,8 @@ int FFmpegAudioDecoder::GetAudioBuffer(struct AVCodecContext* s,
+   ChannelLayout channel_layout =
+       config_.channel_layout() == CHANNEL_LAYOUT_DISCRETE
+           ? CHANNEL_LAYOUT_DISCRETE
+-          : ChannelLayoutToChromeChannelLayout(s->channel_layout, s->channels);
++          : ChannelLayoutToChromeChannelLayout(s->ch_layout.u.mask,
++                                               s->ch_layout.nb_channels);
+ 
+   if (channel_layout == CHANNEL_LAYOUT_UNSUPPORTED) {
+     DLOG(ERROR) << "Unsupported channel layout.";
+commit 62274859104bd828373ae406aa9309e610449ac5
+Author: Ted Meyer <tmathmeyer@chromium.org>
+Date:   Fri Mar 22 19:56:55 2024 +0000
+
+    Replace deprecated use of AVCodecContext::reordered_opaque
+    
+    We can use the AV_CODEC_FLAG_COPY_OPAQUE flag on the codec context
+    now to trigger timestamp propagation.
+    
+    Bug: 330573128
+    Change-Id: I6bc57241a35ab5283742aad8d42acb4dc5e85858
+    Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5384308
+    Commit-Queue: Ted (Chromium) Meyer <tmathmeyer@chromium.org>
+    Reviewed-by: Dan Sanders <sandersd@chromium.org>
+    Cr-Commit-Position: refs/heads/main@{#1277051}
+
+diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
+index bd75477feeabb..8a658a58caac5 100644
+--- src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc
++++ src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc
+@@ -134,7 +134,7 @@ bool FFmpegVideoDecoder::IsCodecSupported(VideoCodec codec) {
+ }
+ 
+ FFmpegVideoDecoder::FFmpegVideoDecoder(MediaLog* media_log)
+-    : media_log_(media_log), state_(kUninitialized), decode_nalus_(false) {
++    : media_log_(media_log), state_(kUninitialized), decode_nalus_(false), timestamp_map_(128) {
+   DVLOG(1) << __func__;
+   thread_checker_.DetachFromThread();
+ }
+@@ -363,8 +363,10 @@ bool FFmpegVideoDecoder::FFmpegDecode(const DecoderBuffer& buffer) {
+     DCHECK(packet.data);
+     DCHECK_GT(packet.size, 0);
+ 
+-    // Let FFmpeg handle presentation timestamp reordering.
+-    codec_context_->reordered_opaque = buffer.timestamp().InMicroseconds();
++    const int64_t timestamp = buffer.timestamp().InMicroseconds();
++    const TimestampId timestamp_id = timestamp_id_generator_.GenerateNextId();
++    timestamp_map_.Put(timestamp_id, timestamp);
++    packet.opaque = reinterpret_cast<void*>(timestamp_id.GetUnsafeValue());
+   }
+   FFmpegDecodingLoop::DecodeStatus decode_status = decoding_loop_->DecodePacket(
+       packet, base::BindRepeating(&FFmpegVideoDecoder::OnNewFrame,
+@@ -423,8 +425,13 @@ bool FFmpegVideoDecoder::OnNewFrame(AVFrame* frame) {
+ 
+   scoped_refptr<VideoFrame> video_frame =
+       reinterpret_cast<VideoFrame*>(av_buffer_get_opaque(frame->buf[0]));
++  const auto ts_id = TimestampId(reinterpret_cast<size_t>(frame->opaque));
++  const auto ts_lookup = timestamp_map_.Get(ts_id);
++  if (ts_lookup == timestamp_map_.end()) {
++    return false;
++  }
+   video_frame->set_timestamp(
+-      base::TimeDelta::FromMicroseconds(frame->reordered_opaque));
++      base::TimeDelta::FromMicroseconds(std::get<1>(*ts_lookup)));
+   video_frame->metadata()->power_efficient = false;
+   output_cb_.Run(video_frame);
+   return true;
+@@ -498,8 +505,10 @@ bool FFmpegVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config,
+   codec_context_->thread_count = GetFFmpegVideoDecoderThreadCount(config);
+   codec_context_->thread_type =
+       FF_THREAD_SLICE | (low_delay ? 0 : FF_THREAD_FRAME);
++
+   codec_context_->opaque = this;
+   codec_context_->get_buffer2 = GetVideoBufferImpl;
++  codec_context_->flags |= AV_CODEC_FLAG_COPY_OPAQUE;
+ 
+   if (base::FeatureList::IsEnabled(kFFmpegAllowLists)) {
+     // Note: FFmpeg will try to free this string, so we must duplicate it.
+diff --git a/media/filters/ffmpeg_video_decoder.h b/media/filters/ffmpeg_video_decoder.h
+index d02cb89c3ddf7..0a2de1c623fff 100644
+--- src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.h
++++ src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.h
+@@ -7,6 +7,8 @@
+ #include <list>
+ #include <memory>
+ 
++#include "base/containers/mru_cache.h"
++#include "base/util/type_safety/id_type.h"
+ #include "base/callback.h"
+ #include "base/macros.h"
+ #include "base/memory/ref_counted.h"
+@@ -87,6 +89,20 @@ class MEDIA_EXPORT FFmpegVideoDecoder : public VideoDecoder {
+   // FFmpeg structures owned by this object.
+   std::unique_ptr<AVCodecContext, ScopedPtrAVFreeContext> codec_context_;
+ 
++  // The gist here is that timestamps need to be 64 bits to store microsecond
++  // precision. A 32 bit integer would overflow at ~35 minutes at this level of
++  // precision. We can't cast the timestamp to the void ptr object used by the
++  // opaque field in ffmpeg then, because it would lose data on a 32 bit build.
++  // However, we don't actually have 2^31 timestamped frames in a single
++  // playback, so it's fine to use the 32 bit value as a key in a map which
++  // contains the actual timestamps. Additionally, we've in the past set 128
++  // outstanding frames for re-ordering as a limit for cross-thread decoding
++  // tasks, so we'll do that here too with the LRU cache.
++  using TimestampId = util::IdType<int64_t, size_t, 0>;
++
++  TimestampId::Generator timestamp_id_generator_;
++  base::MRUCache<TimestampId, int64_t> timestamp_map_;
++
+   VideoDecoderConfig config_;
+ 
+   scoped_refptr<FrameBufferPool> frame_pool_;
+diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
+index 3331581a6fee6..69539fd6594ec 100644
+--- src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc
++++ src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc
+@@ -404,7 +404,9 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context,
+ #if BUILDFLAG(USE_PROPRIETARY_CODECS)
+   // TODO(dalecurtis): Just use the profile from the codec context if ffmpeg
+   // ever starts supporting xHE-AAC.
+-  if (codec == kCodecAAC && codec_context->profile == FF_PROFILE_UNKNOWN) {
++  constexpr uint8_t kXHEAAc = 41;
++  if (codec == kCodecAAC && codec_context->profile == FF_PROFILE_UNKNOWN ||
++      codec_context->profile == kXHEAAc) {
+     // Errors aren't fatal here, so just drop any MediaLog messages.
+     NullMediaLog media_log;
+     mp4::AAC aac_parser;
+diff --git a/media/ffmpeg/ffmpeg_regression_tests.cc b/media/ffmpeg/ffmpeg_regression_tests.cc
+index 05dcb1cd62c75..866f446698947 100644
+--- src/3rdparty/chromium/media/ffmpeg/ffmpeg_regression_tests.cc
++++ src/3rdparty/chromium/media/ffmpeg/ffmpeg_regression_tests.cc
+@@ -90,16 +90,16 @@ FFMPEG_TEST_CASE(Cr62127,
+                  PIPELINE_ERROR_DECODE,
+                  PIPELINE_ERROR_DECODE);
+ FFMPEG_TEST_CASE(Cr93620, "security/93620.ogg", PIPELINE_OK, PIPELINE_OK);
+-FFMPEG_TEST_CASE(Cr100492,
+-                 "security/100492.webm",
+-                 DECODER_ERROR_NOT_SUPPORTED,
+-                 DECODER_ERROR_NOT_SUPPORTED);
++FFMPEG_TEST_CASE(Cr100492, "security/100492.webm", PIPELINE_OK, PIPELINE_OK);
+ FFMPEG_TEST_CASE(Cr100543, "security/100543.webm", PIPELINE_OK, PIPELINE_OK);
+ FFMPEG_TEST_CASE(Cr101458,
+                  "security/101458.webm",
+                  PIPELINE_ERROR_DECODE,
+                  PIPELINE_ERROR_DECODE);
+-FFMPEG_TEST_CASE(Cr108416, "security/108416.webm", PIPELINE_OK, PIPELINE_OK);
++FFMPEG_TEST_CASE(Cr108416,
++                 "security/108416.webm",
++                 PIPELINE_ERROR_DECODE,
++                 PIPELINE_ERROR_DECODE);
+ FFMPEG_TEST_CASE(Cr110849,
+                  "security/110849.mkv",
+                  DEMUXER_ERROR_COULD_NOT_OPEN,
+@@ -154,7 +154,10 @@ FFMPEG_TEST_CASE(Cr234630b,
+                  "security/234630b.mov",
+                  DEMUXER_ERROR_NO_SUPPORTED_STREAMS,
+                  DEMUXER_ERROR_NO_SUPPORTED_STREAMS);
+-FFMPEG_TEST_CASE(Cr242786, "security/242786.webm", PIPELINE_OK, PIPELINE_OK);
++FFMPEG_TEST_CASE(Cr242786,
++                 "security/242786.webm",
++                 PIPELINE_OK,
++                 PIPELINE_ERROR_DECODE);
+ // Test for out-of-bounds access with slightly corrupt file (detection logic
+ // thinks it's a MONO file, but actually contains STEREO audio).
+ FFMPEG_TEST_CASE(Cr275590,
+@@ -372,8 +375,8 @@ FFMPEG_TEST_CASE(WEBM_2,
+                  DEMUXER_ERROR_NO_SUPPORTED_STREAMS);
+ FFMPEG_TEST_CASE(WEBM_4,
+                  "security/out.webm.68798.1929",
+-                 DECODER_ERROR_NOT_SUPPORTED,
+-                 DECODER_ERROR_NOT_SUPPORTED);
++                 PIPELINE_OK,
++                 PIPELINE_OK);
+ FFMPEG_TEST_CASE(WEBM_5, "frame_size_change.webm", PIPELINE_OK, PIPELINE_OK);
+ 
+ // General MKV test cases.
+diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
+index 8a658a58caac5..9d6ed8aeb5c48 100644
+--- src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc
++++ src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc
+@@ -213,7 +213,6 @@ int FFmpegVideoDecoder::GetVideoBuffer(struct AVCodecContext* codec_context,
+   frame->width = coded_size.width();
+   frame->height = coded_size.height();
+   frame->format = codec_context->pix_fmt;
+-  frame->reordered_opaque = codec_context->reordered_opaque;
+ 
+   // Now create an AVBufferRef for the data just allocated. It will own the
+   // reference to the VideoFrame object.
+diff --git a/media/filters/audio_file_reader.cc b/media/filters/audio_file_reader.cc
+index e1be5aa9a5b13..951c003956fb5 100644
+--- src/3rdparty/chromium/media/filters/audio_file_reader.cc
++++ src/3rdparty/chromium/media/filters/audio_file_reader.cc
+@@ -243,10 +243,10 @@ bool AudioFileReader::OnNewFrame(
+   // silence from being output. In the case where we are also discarding some
+   // portion of the packet (as indicated by a negative pts), we further want to
+   // adjust the duration downward by however much exists before zero.
+-  if (audio_codec_ == kCodecAAC && frame->pkt_duration) {
++  if (audio_codec_ == kCodecAAC && frame->duration) {
+     const base::TimeDelta pkt_duration = ConvertFromTimeBase(
+         glue_->format_context()->streams[stream_index_]->time_base,
+-        frame->pkt_duration + std::min(static_cast<int64_t>(0), frame->pts));
++        frame->duration + std::min(static_cast<int64_t>(0), frame->pts));
+     const base::TimeDelta frame_duration = base::TimeDelta::FromSecondsD(
+         frames_read / static_cast<double>(sample_rate_));
+ 
+diff --git a/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc b/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc
+index c6446c2..805b95b 100644
+--- src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc
++++ src/3rdparty/chromium/third_party/webrtc/modules/video_coding/codecs/h264/h264_decoder_impl.cc
+@@ -114,7 +114,6 @@ int H264DecoderImpl::AVGetBuffer2(AVCodecContext* context,
+   int total_size = y_size + 2 * uv_size;
+ 
+   av_frame->format = context->pix_fmt;
+-  av_frame->reordered_opaque = context->reordered_opaque;
+ 
+   // Set |av_frame| members as required by FFmpeg.
+   av_frame->data[kYPlaneIndex] = frame_buffer->MutableDataY();
+@@ -273,8 +272,6 @@ int32_t H264DecoderImpl::Decode(const EncodedImage& input_image,
+     return WEBRTC_VIDEO_CODEC_ERROR;
+   }
+   packet.size = static_cast<int>(input_image.size());
+-  int64_t frame_timestamp_us = input_image.ntp_time_ms_ * 1000;  // ms -> μs
+-  av_context_->reordered_opaque = frame_timestamp_us;
+ 
+   int result = avcodec_send_packet(av_context_.get(), &packet);
+   if (result < 0) {
+@@ -290,10 +287,6 @@ int32_t H264DecoderImpl::Decode(const EncodedImage& input_image,
+     return WEBRTC_VIDEO_CODEC_ERROR;
+   }
+ 
+-  // We don't expect reordering. Decoded frame tamestamp should match
+-  // the input one.
+-  RTC_DCHECK_EQ(av_frame_->reordered_opaque, frame_timestamp_us);
+-
+   absl::optional<uint8_t> qp;
+   // TODO(sakal): Maybe it is possible to get QP directly from FFmpeg.
+   h264_bitstream_parser_.ParseBitstream(input_image.data(), input_image.size());
diff --git a/www/qt5-webengine/files/patch-ffmpeg8 b/www/qt5-webengine/files/patch-ffmpeg8
new file mode 100644
index 000000000000..5e3c624b7f17
--- /dev/null
+++ b/www/qt5-webengine/files/patch-ffmpeg8
@@ -0,0 +1,215 @@
+From 129f48501a7c3fa4236234f2fa0aee490a845b59 Mon Sep 17 00:00:00 2001
+From: Thomas Guilbert <tguilbert@chromium.org>
+Date: Fri, 2 May 2025 08:58:47 -0700
+Subject: [PATCH] Roll src/third_party/ffmpeg/ 01f23648c..dcdd0fa51 (552
+ commits)
+
+This CL rolls ffmpeg for M138.
+
+This roll includes the removal of many deprecated APIs: some FF_*
+macros were consolidated as equivalent AV_* macros under
+libavcodec/def.h
+
+https://chromium.googlesource.com/chromium/third_party/ffmpeg.git/+log/01f23648c6b8..dcdd0fa51b65
+
+$ git log 01f23648c..dcdd0fa51 --date=short --no-merges --format='%ad %ae %s'
+2025-05-01 tguilbert Remove deprecated av_stream_get_side_data()
+2025-05-01 tguilbert README.chromium file
+2025-05-01 tguilbert GN Configuration
+2025-04-29 jamrial avcodec/cbs_apv: don't return an error when reading empty buffers
+2025-04-27 sw fate: Add test for APV 422-10 profile
+(...)
+2025-03-18 andreas.rheinhardt avcodec/Makefile: Only compile executor when VVC decoder is enabled
+2025-03-18 andreas.rheinhardt avcodec/vvc/Makefile: Move VVC decoder->h2645data dep to lavc/Makefile
+2025-03-17 ffmpeg ffbuild: use response files only if ar accepts them
+2025-03-18 timo avcodec/tableprint_vlc: fix build with --enable-hardcoded-tables
+2025-03-18 timo avcodec/Makefile: fix build of exr decoder in odd configs
+
+Created with:
+  roll-dep src/third_party/ffmpeg
+
+Bug: 415118707
+Change-Id: Iae943ce996031d5a6f7dbbd2915ad9cfabadf4d6
+Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6506529
+Reviewed-by: Dale Curtis <dalecurtis@chromium.org>
+Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
+Auto-Submit: Thomas Guilbert <tguilbert@chromium.org>
+Cr-Commit-Position: refs/heads/main@{#1455010}
+---
+ media/ffmpeg/ffmpeg_common.cc                 | 44 +++++++++----------
+ .../filters/ffmpeg_aac_bitstream_converter.cc | 12 ++---
+ ...ffmpeg_aac_bitstream_converter_unittest.cc |  6 +--
+ 5 files changed, 33 insertions(+), 33 deletions(-)
+
+diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
+index cfd0552ee31088..610be2d37b351f 100644
+--- src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc
++++ src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc
+@@ -263,22 +263,22 @@ AVCodecID VideoCodecToCodecID(VideoCodec video_codec) {
+ static VideoCodecProfile ProfileIDToVideoCodecProfile(int profile) {
+   // Clear out the CONSTRAINED & INTRA flags which are strict subsets of the
+   // corresponding profiles with which they're used.
+-  profile &= ~FF_PROFILE_H264_CONSTRAINED;
+-  profile &= ~FF_PROFILE_H264_INTRA;
++  profile &= ~AV_PROFILE_H264_CONSTRAINED;
++  profile &= ~AV_PROFILE_H264_INTRA;
+   switch (profile) {
+-    case FF_PROFILE_H264_BASELINE:
++    case AV_PROFILE_H264_BASELINE:
+       return H264PROFILE_BASELINE;
+-    case FF_PROFILE_H264_MAIN:
++    case AV_PROFILE_H264_MAIN:
+       return H264PROFILE_MAIN;
+-    case FF_PROFILE_H264_EXTENDED:
++    case AV_PROFILE_H264_EXTENDED:
+       return H264PROFILE_EXTENDED;
+-    case FF_PROFILE_H264_HIGH:
++    case AV_PROFILE_H264_HIGH:
+       return H264PROFILE_HIGH;
+-    case FF_PROFILE_H264_HIGH_10:
++    case AV_PROFILE_H264_HIGH_10:
+       return H264PROFILE_HIGH10PROFILE;
+-    case FF_PROFILE_H264_HIGH_422:
++    case AV_PROFILE_H264_HIGH_422:
+       return H264PROFILE_HIGH422PROFILE;
+-    case FF_PROFILE_H264_HIGH_444_PREDICTIVE:
++    case AV_PROFILE_H264_HIGH_444_PREDICTIVE:
+       return H264PROFILE_HIGH444PREDICTIVEPROFILE;
+     default:
+       DVLOG(1) << "Unknown profile id: " << profile;
+@@ -289,23 +289,23 @@ static VideoCodecProfile ProfileIDToVideoCodecProfile(int profile) {
+ static int VideoCodecProfileToProfileID(VideoCodecProfile profile) {
+   switch (profile) {
+     case H264PROFILE_BASELINE:
+-      return FF_PROFILE_H264_BASELINE;
++      return AV_PROFILE_H264_BASELINE;
+     case H264PROFILE_MAIN:
+-      return FF_PROFILE_H264_MAIN;
++      return AV_PROFILE_H264_MAIN;
+     case H264PROFILE_EXTENDED:
+-      return FF_PROFILE_H264_EXTENDED;
++      return AV_PROFILE_H264_EXTENDED;
+     case H264PROFILE_HIGH:
+-      return FF_PROFILE_H264_HIGH;
++      return AV_PROFILE_H264_HIGH;
+     case H264PROFILE_HIGH10PROFILE:
+-      return FF_PROFILE_H264_HIGH_10;
++      return AV_PROFILE_H264_HIGH_10;
+     case H264PROFILE_HIGH422PROFILE:
+-      return FF_PROFILE_H264_HIGH_422;
++      return AV_PROFILE_H264_HIGH_422;
+     case H264PROFILE_HIGH444PREDICTIVEPROFILE:
+-      return FF_PROFILE_H264_HIGH_444_PREDICTIVE;
++      return AV_PROFILE_H264_HIGH_444_PREDICTIVE;
+     default:
+       DVLOG(1) << "Unknown VideoCodecProfile: " << profile;
+   }
+-  return FF_PROFILE_UNKNOWN;
++  return AV_PROFILE_UNKNOWN;
+ }
+ 
+ SampleFormat AVSampleFormatToSampleFormat(AVSampleFormat sample_format,
+@@ -443,7 +443,7 @@ bool AVCodecContextToAudioDecoderConfig(const AVCodecContext* codec_context,
+   // TODO(dalecurtis): Just use the profile from the codec context if ffmpeg
+   // ever starts supporting xHE-AAC.
+   constexpr uint8_t kXHEAAc = 41;
+-  if (codec == kCodecAAC && codec_context->profile == FF_PROFILE_UNKNOWN ||
++  if (codec == kCodecAAC && codec_context->profile == AV_PROFILE_UNKNOWN ||
+       codec_context->profile == kXHEAAc) {
+     // Errors aren't fatal here, so just drop any MediaLog messages.
+     NullMediaLog media_log;
+@@ -661,16 +661,16 @@ bool AVStreamToVideoDecoderConfig(const AVStream* stream,
+       break;
+     case VideoCodec::kVP9:
+       switch (codec_context->profile) {
+-        case FF_PROFILE_VP9_0:
++        case AV_PROFILE_VP9_0:
+           profile = VP9PROFILE_PROFILE0;
+           break;
+-        case FF_PROFILE_VP9_1:
++        case AV_PROFILE_VP9_1:
+           profile = VP9PROFILE_PROFILE1;
+           break;
+-        case FF_PROFILE_VP9_2:
++        case AV_PROFILE_VP9_2:
+           profile = VP9PROFILE_PROFILE2;
+           break;
+-        case FF_PROFILE_VP9_3:
++        case AV_PROFILE_VP9_3:
+           profile = VP9PROFILE_PROFILE3;
+           break;
+         default:
+diff --git a/media/filters/ffmpeg_aac_bitstream_converter.cc b/media/filters/ffmpeg_aac_bitstream_converter.cc
+index 7fd37e90b7e475..c00ac262dabb19 100644
+--- src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc
++++ src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc
+@@ -68,17 +68,17 @@ bool GenerateAdtsHeader(int codec,
+   hdr[1] |= 1;
+ 
+   switch (audio_profile) {
+-    case FF_PROFILE_AAC_MAIN:
++    case AV_PROFILE_AAC_MAIN:
+       break;
+-    case FF_PROFILE_AAC_HE:
+-    case FF_PROFILE_AAC_HE_V2:
+-    case FF_PROFILE_AAC_LOW:
++    case AV_PROFILE_AAC_HE:
++    case AV_PROFILE_AAC_HE_V2:
++    case AV_PROFILE_AAC_LOW:
+       hdr[2] |= (1 << 6);
+       break;
+-    case FF_PROFILE_AAC_SSR:
++    case AV_PROFILE_AAC_SSR:
+       hdr[2] |= (2 << 6);
+       break;
+-    case FF_PROFILE_AAC_LTP:
++    case AV_PROFILE_AAC_LTP:
+       hdr[2] |= (3 << 6);
+       break;
+     default:
+diff --git a/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc b/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc
+index 0e56a6ea5b5cb4..2a6ccb8c910f6c 100644
+--- src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc
++++ src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter_unittest.cc
+@@ -41,7 +41,7 @@ class FFmpegAACBitstreamConverterTest : public testing::Test {
+     // Set up reasonable aac parameters
+     memset(&test_parameters_, 0, sizeof(AVCodecParameters));
+     test_parameters_.codec_id = AV_CODEC_ID_AAC;
+-    test_parameters_.profile = FF_PROFILE_AAC_MAIN;
++    test_parameters_.profile = AV_PROFILE_AAC_MAIN;
+     test_parameters_.ch_layout.nb_channels = 2;
+     test_parameters_.extradata = extradata_header_;
+     test_parameters_.extradata_size = sizeof(extradata_header_);
+@@ -131,7 +131,7 @@ TEST_F(FFmpegAACBitstreamConverterTest, Conversion_AudioProfileType) {
+ 
+   EXPECT_EQ(profile, kAacMainProfile);
+ 
+-  test_parameters_.profile = FF_PROFILE_AAC_HE;
++  test_parameters_.profile = AV_PROFILE_AAC_HE;
+   FFmpegAACBitstreamConverter converter_he(&test_parameters_);
+ 
+   test_packet = ScopedAVPacket::Allocate();
+@@ -143,7 +143,7 @@ TEST_F(FFmpegAACBitstreamConverterTest, Conversion_AudioProfileType) {
+ 
+   EXPECT_EQ(profile, kAacLowComplexityProfile);
+ 
+-  test_parameters_.profile = FF_PROFILE_AAC_ELD;
++  test_parameters_.profile = AV_PROFILE_AAC_ELD;
+   FFmpegAACBitstreamConverter converter_eld(&test_parameters_);
+ 
+   test_packet = ScopedAVPacket::Allocate();
+--- src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc.orig       2025-12-28 00:42:25.941089000 -0500
++++ src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc    2025-12-28 01:30:45.155201000 -0500
+@@ -645,9 +645,9 @@
+                      coded_size, visible_rect, natural_size, extra_data,
+                      GetEncryptionScheme(stream));
+ 
+-  if (stream->nb_side_data) {
+-    for (int i = 0; i < stream->nb_side_data; ++i) {
+-      AVPacketSideData side_data = stream->side_data[i];
++  if (stream->codecpar->nb_coded_side_data) {
++    for (int i = 0; i < stream->codecpar->nb_coded_side_data; ++i) {
++      const auto& side_data = stream->codecpar->coded_side_data[i];
+       if (side_data.type != AV_PKT_DATA_MASTERING_DISPLAY_METADATA)
+         continue;
+