summaryrefslogtreecommitdiffstats
path: root/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
diff options
context:
space:
mode:
authortrav90 <travawine@protonmail.ch>2018-04-28 14:00:09 -0500
committertrav90 <travawine@protonmail.ch>2018-04-28 14:20:52 -0500
commit29c293b100e046eaf82ceadbf676c0226b0e9e82 (patch)
tree43d8fb4d1c8a79952a6dbf1ed87be8e1cbbfc246 /dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
parentb45f40ff9b410e919bb299cdf4da68acdb06ff2b (diff)
downloadUXP-29c293b100e046eaf82ceadbf676c0226b0e9e82.tar
UXP-29c293b100e046eaf82ceadbf676c0226b0e9e82.tar.gz
UXP-29c293b100e046eaf82ceadbf676c0226b0e9e82.tar.lz
UXP-29c293b100e046eaf82ceadbf676c0226b0e9e82.tar.xz
UXP-29c293b100e046eaf82ceadbf676c0226b0e9e82.zip
Add support for libavcodec 58/FFmpeg 4.0
Diffstat (limited to 'dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp')
-rw-r--r--dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp6
1 files changed, 6 insertions, 0 deletions
diff --git a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
index 0b31fb0f9..8cb5c8578 100644
--- a/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
+++ b/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
@@ -69,15 +69,21 @@ FFmpegDataDecoder<LIBAV_VER>::InitDecoder()
mCodecContext->extradata_size = mExtraData->Length();
// FFmpeg may use SIMD instructions to access the data which reads the
// data in 32 bytes block. Must ensure we have enough data to read.
+#if LIBAVCODEC_VERSION_MAJOR >= 58
+ mExtraData->AppendElements(AV_INPUT_BUFFER_PADDING_SIZE);
+#else
mExtraData->AppendElements(FF_INPUT_BUFFER_PADDING_SIZE);
+#endif
mCodecContext->extradata = mExtraData->Elements();
} else {
mCodecContext->extradata_size = 0;
}
+#if LIBAVCODEC_VERSION_MAJOR < 57
if (codec->capabilities & CODEC_CAP_DR1) {
mCodecContext->flags |= CODEC_FLAG_EMU_EDGE;
}
+#endif
if (mLib->avcodec_open2(mCodecContext, codec, nullptr) < 0) {
NS_WARNING("Couldn't initialise ffmpeg decoder");