File chromium-93-ffmpeg-4.4.patch of Package chromium-ffmpeg-extra (Revision 4407c879c2f3d7778ebd138b74f5810a)

Currently displaying revision 4407c879c2f3d7778ebd138b74f5810a , Show latest

86
 
1
From: 52c3e9c0f140a8742034e107fb0f371c0d73bf1d Mon Sep 17 00:00:00 2001
2
From: =?UTF-8?q?Marek=20Beh=C3=BAn?= <kabel@kernel.org>
3
Date: Sun, 12 Sep 2021 04:20:11 +0200
4
Subject: [PATCH] chromium-93: fix building with system-ffmpeg
5
MIME-Version: 1.0
6
Content-Type: text/plain; charset=UTF-8
7
Content-Transfer-Encoding: 8bit
8
9
The version of ffmpeg bundled in Chromium changed ABI a little, which
10
affected the code in that the type of the last parameter of
11
av_packet_get_side_data() is now size_t instead of int.
12
13
This causes Chromium to fail to build with system-ffmpeg if the system
14
ffmpeg's version does not yet have this ABI change.
15
16
Fix the code to be able to compile with older ffmpeg as well.
17
18
Signed-off-by: Marek Behún <kabel@kernel.org>
19
---
20
 media/filters/audio_decoder_unittest.cc |  4 ++++
21
 media/filters/ffmpeg_demuxer.cc         | 16 ++++++++++++++++
22
 2 files changed, 20 insertions(+)
23
24
diff --git a/media/filters/audio_decoder_unittest.cc b/media/filters/audio_decoder_unittest.cc
25
--- a/media/filters/audio_decoder_unittest.cc
26
+++ b/media/filters/audio_decoder_unittest.cc
27
@@ -109,7 +109,11 @@ void SetDiscardPadding(AVPacket* packet,
28
   }
29
 
30
   // If the timestamp is positive, try to use FFmpeg's discard data.
31
+#if LIBAVUTIL_VERSION_MAJOR < 57
32
+  int skip_samples_size = 0;
33
+#else
34
   size_t skip_samples_size = 0;
35
+#endif
36
   const uint32_t* skip_samples_ptr =
37
       reinterpret_cast<const uint32_t*>(av_packet_get_side_data(
38
           packet, AV_PKT_DATA_SKIP_SAMPLES, &skip_samples_size));
39
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
40
--- a/media/filters/ffmpeg_demuxer.cc
41
+++ b/media/filters/ffmpeg_demuxer.cc
42
@@ -427,11 +427,19 @@ void FFmpegDemuxerStream::EnqueuePacket(
43
   scoped_refptr<DecoderBuffer> buffer;
44
 
45
   if (type() == DemuxerStream::TEXT) {
46
+#if LIBAVUTIL_VERSION_MAJOR < 57
47
+    int id_size = 0;
48
+#else
49
     size_t id_size = 0;
50
+#endif
51
     uint8_t* id_data = av_packet_get_side_data(
52
         packet.get(), AV_PKT_DATA_WEBVTT_IDENTIFIER, &id_size);
53
 
54
+#if LIBAVUTIL_VERSION_MAJOR < 57
55
+    int settings_size = 0;
56
+#else
57
     size_t settings_size = 0;
58
+#endif
59
     uint8_t* settings_data = av_packet_get_side_data(
60
         packet.get(), AV_PKT_DATA_WEBVTT_SETTINGS, &settings_size);
61
 
62
@@ -443,7 +451,11 @@ void FFmpegDemuxerStream::EnqueuePacket(
63
     buffer = DecoderBuffer::CopyFrom(packet->data, packet->size,
64
                                      side_data.data(), side_data.size());
65
   } else {
66
+#if LIBAVUTIL_VERSION_MAJOR < 57
67
+    int side_data_size = 0;
68
+#else
69
     size_t side_data_size = 0;
70
+#endif
71
     uint8_t* side_data = av_packet_get_side_data(
72
         packet.get(), AV_PKT_DATA_MATROSKA_BLOCKADDITIONAL, &side_data_size);
73
 
74
@@ -504,7 +516,11 @@ void FFmpegDemuxerStream::EnqueuePacket(
75
                                        packet->size - data_offset);
76
     }
77
 
78
+#if LIBAVUTIL_VERSION_MAJOR < 57
79
+    int skip_samples_size = 0;
80
+#else
81
     size_t skip_samples_size = 0;
82
+#endif
83
     const uint32_t* skip_samples_ptr =
84
         reinterpret_cast<const uint32_t*>(av_packet_get_side_data(
85
             packet.get(), AV_PKT_DATA_SKIP_SAMPLES, &skip_samples_size));
86