summaryrefslogtreecommitdiffstats
path: root/dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
diff options
context:
space:
mode:
authorMoonchild <mcwerewolf@gmail.com>2018-05-03 07:10:28 +0200
committerGitHub <noreply@github.com>2018-05-03 07:10:28 +0200
commit20532e13937ab5fc8efcb2bfc4c0070dace40cd1 (patch)
tree487982dc05c566582b484cbea7dacec3f8d87a6b /dom/media/platforms/ffmpeg/FFmpegDataDecoder.cpp
parentb1728772a796834e7bd9e6707e8855bee49b5368 (diff)
parent29c293b100e046eaf82ceadbf676c0226b0e9e82 (diff)
downloadUXP-20532e13937ab5fc8efcb2bfc4c0070dace40cd1.tar
UXP-20532e13937ab5fc8efcb2bfc4c0070dace40cd1.tar.gz
UXP-20532e13937ab5fc8efcb2bfc4c0070dace40cd1.tar.lz
UXP-20532e13937ab5fc8efcb2bfc4c0070dace40cd1.tar.xz
UXP-20532e13937ab5fc8efcb2bfc4c0070dace40cd1.zip
Merge pull request #322 from trav90/ffmpeg-work
Add support for FFmpeg 4.0/libavcodec 58
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");