commit bb7eb80def7c06ea0395af3c3466ef8515f1802c
Author: Kevin Kofler <kevin.kofler(a)chello.at>
Date: Tue Feb 20 00:49:10 2018 +0100
Fix build with FFmpeg 3.5 (apply conditionally because it breaks older FFmpeg)
qt5-qtwebengine-freeworld.spec | 7 +
qtwebengine-everywhere-src-5.10.1-ffmpeg35.patch | 218 +++++++++++++++++++++++
2 files changed, 225 insertions(+)
---
diff --git a/qt5-qtwebengine-freeworld.spec b/qt5-qtwebengine-freeworld.spec
index 7362d3b..c913faf 100644
--- a/qt5-qtwebengine-freeworld.spec
+++ b/qt5-qtwebengine-freeworld.spec
@@ -105,6 +105,9 @@ Patch23: qtwebengine-everywhere-src-5.10.0-QTBUG-64759.patch
# see:
http://www.unicode.org/reports/tr31/#Aspirational_Use_Scripts
# backport of:
https://chromium-review.googlesource.com/c/chromium/src/+/731871
Patch100: qtwebengine-everywhere-src-5.10.0-no-aspirational-scripts.patch
+# fix build with FFmpeg 3.5 (apply conditionally because it breaks older FFmpeg)
+# backport of:
https://chromium-review.googlesource.com/c/chromium/src/+/754261
+Patch101: qtwebengine-everywhere-src-5.10.1-ffmpeg35.patch
# handled by qt5-srpm-macros, which defines %%qt5_qtwebengine_arches
ExclusiveArch: %{qt5_qtwebengine_arches}
@@ -334,6 +337,9 @@ This version is compiled with support for patent-encumbered codecs
enabled.
%patch23 -p1 -b .QTBUG-64759
%endif
%patch100 -p1 -b .no-aspirational-scripts
+%if 0%{?fedora} > 27
+%patch101 -p1 -b .ffmpeg35
+%endif
# fix // in #include in content/renderer/gpu to avoid debugedit failure
sed -i -e 's!gpu//!gpu/!g' \
src/3rdparty/chromium/content/renderer/gpu/compositor_forwarding_message_filter.cc
@@ -417,6 +423,7 @@ echo "%{_libdir}/%{name}" \
- Rediff (unfuzz) no-sse2 patch
- Workaround FTBFS with GCC 8, build with -fabi-version=11 on F28+ (rh#1545918)
- Reenable system libvpx on F28+, Rawhide (future F28) has libvpx 1.7.0 now
+- Fix build with FFmpeg 3.5 (apply conditionally because it breaks older FFmpeg)
* Sat Dec 30 2017 Kevin Kofler <Kevin(a)tigcc.ticalc.org> - 5.10.0-1
- Update to 5.10.0
diff --git a/qtwebengine-everywhere-src-5.10.1-ffmpeg35.patch
b/qtwebengine-everywhere-src-5.10.1-ffmpeg35.patch
new file mode 100644
index 0000000..9b8ec0e
--- /dev/null
+++ b/qtwebengine-everywhere-src-5.10.1-ffmpeg35.patch
@@ -0,0 +1,218 @@
+diff -ur
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.cc
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.cc
+---
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.cc 2018-02-02
11:39:52.000000000 +0100
++++
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_audio_decoder.cc 2018-02-20
00:36:46.538199224 +0100
+@@ -71,11 +71,11 @@
+ if (config.extra_data) {
+ codec_context->extradata_size = config.extra_data_size;
+ codec_context->extradata = reinterpret_cast<uint8_t*>(
+- av_malloc(config.extra_data_size + FF_INPUT_BUFFER_PADDING_SIZE));
++ av_malloc(config.extra_data_size + AV_INPUT_BUFFER_PADDING_SIZE));
+ memcpy(codec_context->extradata, config.extra_data,
+ config.extra_data_size);
+ memset(codec_context->extradata + config.extra_data_size, '\0',
+- FF_INPUT_BUFFER_PADDING_SIZE);
++ AV_INPUT_BUFFER_PADDING_SIZE);
+ } else {
+ codec_context->extradata = NULL;
+ codec_context->extradata_size = 0;
+diff -ur
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_video_decoder.cc
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_video_decoder.cc
+---
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_video_decoder.cc 2018-02-02
11:39:52.000000000 +0100
++++
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/cdm/ppapi/external_clear_key/ffmpeg_cdm_video_decoder.cc 2018-02-20
00:36:46.538199224 +0100
+@@ -101,11 +101,11 @@
+ if (config.extra_data) {
+ codec_context->extradata_size = config.extra_data_size;
+ codec_context->extradata = reinterpret_cast<uint8_t*>(
+- av_malloc(config.extra_data_size + FF_INPUT_BUFFER_PADDING_SIZE));
++ av_malloc(config.extra_data_size + AV_INPUT_BUFFER_PADDING_SIZE));
+ memcpy(codec_context->extradata, config.extra_data,
+ config.extra_data_size);
+ memset(codec_context->extradata + config.extra_data_size, 0,
+- FF_INPUT_BUFFER_PADDING_SIZE);
++ AV_INPUT_BUFFER_PADDING_SIZE);
+ } else {
+ codec_context->extradata = NULL;
+ codec_context->extradata_size = 0;
+@@ -164,7 +164,6 @@
+ codec_context_->err_recognition = AV_EF_CAREFUL;
+ codec_context_->thread_count = kDecodeThreads;
+ codec_context_->opaque = this;
+- codec_context_->flags |= CODEC_FLAG_EMU_EDGE;
+
+ AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
+ if (!codec) {
+diff -ur
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc
+---
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc 2018-02-02
11:39:52.000000000 +0100
++++
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.cc 2018-02-20
00:36:46.538199224 +0100
+@@ -30,10 +30,10 @@
+
+ } // namespace
+
+-// Why FF_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
++// Why AV_INPUT_BUFFER_PADDING_SIZE? FFmpeg assumes all input buffers are
+ // padded. Check here to ensure FFmpeg only receives data padded to its
+ // specifications.
+-static_assert(DecoderBuffer::kPaddingSize >= FF_INPUT_BUFFER_PADDING_SIZE,
++static_assert(DecoderBuffer::kPaddingSize >= AV_INPUT_BUFFER_PADDING_SIZE,
+ "DecoderBuffer padding size does not fit ffmpeg requirement");
+
+ // Alignment requirement by FFmpeg for input and output buffers. This need to
+@@ -444,11 +444,11 @@
+ } else {
+ codec_context->extradata_size = config.extra_data().size();
+ codec_context->extradata = reinterpret_cast<uint8_t*>(
+- av_malloc(config.extra_data().size() + FF_INPUT_BUFFER_PADDING_SIZE));
++ av_malloc(config.extra_data().size() + AV_INPUT_BUFFER_PADDING_SIZE));
+ memcpy(codec_context->extradata, &config.extra_data()[0],
+ config.extra_data().size());
+ memset(codec_context->extradata + config.extra_data().size(), '\0',
+- FF_INPUT_BUFFER_PADDING_SIZE);
++ AV_INPUT_BUFFER_PADDING_SIZE);
+ }
+ }
+
+@@ -585,11 +585,11 @@
+ } else {
+ codec_context->extradata_size = config.extra_data().size();
+ codec_context->extradata = reinterpret_cast<uint8_t*>(
+- av_malloc(config.extra_data().size() + FF_INPUT_BUFFER_PADDING_SIZE));
++ av_malloc(config.extra_data().size() + AV_INPUT_BUFFER_PADDING_SIZE));
+ memcpy(codec_context->extradata, &config.extra_data()[0],
+ config.extra_data().size());
+ memset(codec_context->extradata + config.extra_data().size(), '\0',
+- FF_INPUT_BUFFER_PADDING_SIZE);
++ AV_INPUT_BUFFER_PADDING_SIZE);
+ }
+ }
+
+diff -ur
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.h
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.h
+---
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.h 2018-02-02
11:39:52.000000000 +0100
++++
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/ffmpeg/ffmpeg_common.h 2018-02-20
00:36:46.538199224 +0100
+@@ -24,22 +24,7 @@
+
+ // Include FFmpeg header files.
+ extern "C" {
+-#if !BUILDFLAG(USE_SYSTEM_FFMPEG)
+-// Disable deprecated features which result in spammy compile warnings. This
+-// list of defines must mirror those in the 'defines' section of FFmpeg's
+-// BUILD.gn file or the headers below will generate different structures!
+-#define FF_API_CONVERGENCE_DURATION 0
+-#endif // !BUILDFLAG(USE_SYSTEM_FFMPEG)
+-// Upstream libavcodec/utils.c still uses the deprecated
+-// av_dup_packet(), causing deprecation warnings.
+-// The normal fix for such things is to disable the feature as below,
+-// but the upstream code does not yet compile with it disabled.
+-// (In this case, the fix is replacing the call with a new function.)
+-// In the meantime, we directly disable those warnings in the C file.
+-//#define FF_API_AVPACKET_OLD_API 0
+-
+ // Temporarily disable possible loss of data warning.
+-// TODO(scherkus): fix and upstream the compiler warnings.
+ MSVC_PUSH_DISABLE_WARNING(4244);
+ #include <libavcodec/avcodec.h>
+ #include <libavformat/avformat.h>
+diff -ur
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc
+---
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc 2018-02-02
11:39:52.000000000 +0100
++++
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/filters/ffmpeg_aac_bitstream_converter.cc 2018-02-20
00:37:14.173777777 +0100
+@@ -239,8 +239,9 @@
+
+ // Release the old packet.
+ av_packet_unref(packet);
+- *packet = dest_packet; // Finally, replace the values in the input packet.
+
++ // Finally, replace the values in the input packet.
++ memcpy(packet, &dest_packet, sizeof(*packet));
+ return true;
+ }
+
+diff -ur
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc
+---
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc 2018-02-02
11:39:52.000000000 +0100
++++
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/filters/ffmpeg_audio_decoder.cc 2018-02-20
00:37:14.173777777 +0100
+@@ -323,7 +323,6 @@
+
+ codec_context_->opaque = this;
+ codec_context_->get_buffer2 = GetAudioBufferImpl;
+- codec_context_->refcounted_frames = 1;
+
+ if (config.codec() == kCodecOpus)
+ codec_context_->request_sample_fmt = AV_SAMPLE_FMT_FLT;
+@@ -368,7 +367,7 @@
+ int FFmpegAudioDecoder::GetAudioBuffer(struct AVCodecContext* s,
+ AVFrame* frame,
+ int flags) {
+- DCHECK(s->codec->capabilities & CODEC_CAP_DR1);
++ DCHECK(s->codec->capabilities & AV_CODEC_CAP_DR1);
+ DCHECK_EQ(s->codec_type, AVMEDIA_TYPE_AUDIO);
+
+ // Since this routine is called by FFmpeg when a buffer is required for audio
+diff -ur
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/filters/ffmpeg_demuxer_unittest.cc
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/filters/ffmpeg_demuxer_unittest.cc
+---
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/filters/ffmpeg_demuxer_unittest.cc 2018-02-02
11:39:52.000000000 +0100
++++
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/filters/ffmpeg_demuxer_unittest.cc 2018-02-20
00:37:14.174777762 +0100
+@@ -878,7 +878,8 @@
+ EXPECT_LT(bytes_read_with_video_disabled, bytes_read_with_video_enabled);
+ }
+
+-TEST_F(FFmpegDemuxerTest, Read_DiscardDisabledTextStream) {
++// WebM text track discarding doesn't work in ffmpeg.
http://crbug.com/681886.
++TEST_F(FFmpegDemuxerTest, DISABLED_Read_DiscardDisabledTextStream) {
+ // This test case reads the same video frame twice, first with the text track
+ // enabled, then with the text track disabled. When the text track is
+ // disabled, FFmpegDemuxer sets the AVDISCARD_ALL flag on the corresponding
+@@ -1081,11 +1082,11 @@
+ base::RunLoop().Run();
+
+ // Text read #1.
+- text_stream->Read(NewReadCB(FROM_HERE, 19, 500000, true));
++ text_stream->Read(NewReadCB(FROM_HERE, 19, 1000000, true));
+ base::RunLoop().Run();
+
+ // Text read #2.
+- text_stream->Read(NewReadCB(FROM_HERE, 19, 1000000, true));
++ text_stream->Read(NewReadCB(FROM_HERE, 19, 1500000, true));
+ base::RunLoop().Run();
+ }
+
+diff -ur
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc
+---
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc 2018-02-02
11:39:52.000000000 +0100
++++
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/filters/ffmpeg_h264_to_annex_b_bitstream_converter.cc 2018-02-20
00:37:14.174777762 +0100
+@@ -73,8 +73,9 @@
+
+ // At the end we must destroy the old packet.
+ av_packet_unref(packet);
+- *packet = dest_packet; // Finally, replace the values in the input packet.
+
++ // Finally, replace the values in the input packet.
++ memcpy(packet, &dest_packet, sizeof(*packet));
+ return true;
+ }
+
+diff -ur
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.cc
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.cc
+---
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.cc 2018-02-02
11:39:52.000000000 +0100
++++
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/filters/ffmpeg_h265_to_annex_b_bitstream_converter.cc 2018-02-20
00:37:14.174777762 +0100
+@@ -86,8 +86,9 @@
+
+ // At the end we must destroy the old packet.
+ av_packet_unref(packet);
+- *packet = dest_packet; // Finally, replace the values in the input packet.
+
++ // Finally, replace the values in the input packet.
++ memcpy(packet, &dest_packet, sizeof(*packet));
+ return true;
+ }
+
+diff -ur
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc
+---
qtwebengine-everywhere-src-5.10.1/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc 2018-02-02
11:39:52.000000000 +0100
++++
qtwebengine-everywhere-src-5.10.1-ffmpeg35/src/3rdparty/chromium/media/filters/ffmpeg_video_decoder.cc 2018-02-20
00:37:14.174777762 +0100
+@@ -427,12 +427,10 @@
+ codec_context_->thread_type =
+ FF_THREAD_SLICE | (low_delay ? 0 : FF_THREAD_FRAME);
+ codec_context_->opaque = this;
+- codec_context_->flags |= CODEC_FLAG_EMU_EDGE;
+ codec_context_->get_buffer2 = GetVideoBufferImpl;
+- codec_context_->refcounted_frames = 1;
+
+ if (decode_nalus_)
+- codec_context_->flags2 |= CODEC_FLAG2_CHUNKS;
++ codec_context_->flags2 |= AV_CODEC_FLAG2_CHUNKS;
+
+ AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
+ if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {