Commit f673873b authored by Dale Curtis's avatar Dale Curtis Committed by Commit Bot

Roll FFmpeg for M64.

BUG=777555
TEST=cq

Cq-Include-Trybots: master.tryserver.chromium.android:android_optional_gpu_tests_rel;master.tryserver.chromium.linux:linux_optional_gpu_tests_rel;master.tryserver.chromium.mac:mac_optional_gpu_tests_rel;master.tryserver.chromium.win:win_optional_gpu_tests_rel
Change-Id: I8343b5afab16dfcf7d0f7438a675593ddef5f30b
Reviewed-on: https://chromium-review.googlesource.com/754261
Commit-Queue: Dale Curtis <dalecurtis@chromium.org>
Reviewed-by: default avatarChrome Cunningham <chcunningham@chromium.org>
Cr-Commit-Position: refs/heads/master@{#515365}
parent db357083
...@@ -330,7 +330,7 @@ deps = { ...@@ -330,7 +330,7 @@ deps = {
}, },
'src/third_party/ffmpeg': 'src/third_party/ffmpeg':
Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + 'c33a5ee8e7b013b43e7fa9e0224857abc21564c2', Var('chromium_git') + '/chromium/third_party/ffmpeg.git' + '@' + 'c99db0ab53a43f09e65caf0b546c8a4b19a36f60',
'src/third_party/findbugs': { 'src/third_party/findbugs': {
'url': Var('chromium_git') + '/chromium/deps/findbugs.git' + '@' + '57f05238d3ac77ea0a194813d3065dd780c6e566', 'url': Var('chromium_git') + '/chromium/deps/findbugs.git' + '@' + '57f05238d3ac77ea0a194813d3065dd780c6e566',
......
...@@ -67,11 +67,11 @@ static void CdmAudioDecoderConfigToAVCodecContext( ...@@ -67,11 +67,11 @@ static void CdmAudioDecoderConfigToAVCodecContext(
if (config.extra_data) { if (config.extra_data) {
codec_context->extradata_size = config.extra_data_size; codec_context->extradata_size = config.extra_data_size;
codec_context->extradata = reinterpret_cast<uint8_t*>( 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, memcpy(codec_context->extradata, config.extra_data,
config.extra_data_size); config.extra_data_size);
memset(codec_context->extradata + config.extra_data_size, '\0', memset(codec_context->extradata + config.extra_data_size, '\0',
FF_INPUT_BUFFER_PADDING_SIZE); AV_INPUT_BUFFER_PADDING_SIZE);
} else { } else {
codec_context->extradata = NULL; codec_context->extradata = NULL;
codec_context->extradata_size = 0; codec_context->extradata_size = 0;
...@@ -245,12 +245,19 @@ cdm::Status FFmpegCdmAudioDecoder::DecodeBuffer( ...@@ -245,12 +245,19 @@ cdm::Status FFmpegCdmAudioDecoder::DecodeBuffer(
packet.data = const_cast<uint8_t*>(compressed_buffer); packet.data = const_cast<uint8_t*>(compressed_buffer);
packet.size = compressed_buffer_size; packet.size = compressed_buffer_size;
if (decoding_loop_->DecodePacket( switch (decoding_loop_->DecodePacket(
&packet, base::BindRepeating(&FFmpegCdmAudioDecoder::OnNewFrame, &packet, base::BindRepeating(&FFmpegCdmAudioDecoder::OnNewFrame,
base::Unretained(this), &total_size, base::Unretained(this), &total_size,
&audio_frames)) != &audio_frames))) {
FFmpegDecodingLoop::DecodeStatus::kOkay) { case FFmpegDecodingLoop::DecodeStatus::kSendPacketFailed:
return cdm::kDecodeError; return cdm::kDecodeError;
case FFmpegDecodingLoop::DecodeStatus::kFrameProcessingFailed:
NOTREACHED();
case FFmpegDecodingLoop::DecodeStatus::kDecodeFrameFailed:
DLOG(WARNING) << " failed to decode an audio buffer: "
<< timestamp.InMicroseconds();
case FFmpegDecodingLoop::DecodeStatus::kOkay:
break;
} }
if (output_timestamp_helper_->base_timestamp() == kNoTimestamp && if (output_timestamp_helper_->base_timestamp() == kNoTimestamp &&
......
...@@ -97,11 +97,11 @@ static void CdmVideoDecoderConfigToAVCodecContext( ...@@ -97,11 +97,11 @@ static void CdmVideoDecoderConfigToAVCodecContext(
if (config.extra_data) { if (config.extra_data) {
codec_context->extradata_size = config.extra_data_size; codec_context->extradata_size = config.extra_data_size;
codec_context->extradata = reinterpret_cast<uint8_t*>( 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, memcpy(codec_context->extradata, config.extra_data,
config.extra_data_size); config.extra_data_size);
memset(codec_context->extradata + config.extra_data_size, 0, memset(codec_context->extradata + config.extra_data_size, 0,
FF_INPUT_BUFFER_PADDING_SIZE); AV_INPUT_BUFFER_PADDING_SIZE);
} else { } else {
codec_context->extradata = NULL; codec_context->extradata = NULL;
codec_context->extradata_size = 0; codec_context->extradata_size = 0;
...@@ -160,7 +160,6 @@ bool FFmpegCdmVideoDecoder::Initialize(const cdm::VideoDecoderConfig& config) { ...@@ -160,7 +160,6 @@ bool FFmpegCdmVideoDecoder::Initialize(const cdm::VideoDecoderConfig& config) {
codec_context_->err_recognition = AV_EF_CAREFUL; codec_context_->err_recognition = AV_EF_CAREFUL;
codec_context_->thread_count = kDecodeThreads; codec_context_->thread_count = kDecodeThreads;
codec_context_->opaque = this; codec_context_->opaque = this;
codec_context_->flags |= CODEC_FLAG_EMU_EDGE;
AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id); AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
if (!codec) { if (!codec) {
......
...@@ -30,10 +30,10 @@ EncryptionScheme GetEncryptionScheme(const AVStream* stream) { ...@@ -30,10 +30,10 @@ EncryptionScheme GetEncryptionScheme(const AVStream* stream) {
} // namespace } // 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 // padded. Check here to ensure FFmpeg only receives data padded to its
// specifications. // 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"); "DecoderBuffer padding size does not fit ffmpeg requirement");
// Alignment requirement by FFmpeg for input and output buffers. This need to // Alignment requirement by FFmpeg for input and output buffers. This need to
...@@ -433,11 +433,11 @@ void AudioDecoderConfigToAVCodecContext(const AudioDecoderConfig& config, ...@@ -433,11 +433,11 @@ void AudioDecoderConfigToAVCodecContext(const AudioDecoderConfig& config,
} else { } else {
codec_context->extradata_size = config.extra_data().size(); codec_context->extradata_size = config.extra_data().size();
codec_context->extradata = reinterpret_cast<uint8_t*>( 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], memcpy(codec_context->extradata, &config.extra_data()[0],
config.extra_data().size()); config.extra_data().size());
memset(codec_context->extradata + config.extra_data().size(), '\0', memset(codec_context->extradata + config.extra_data().size(), '\0',
FF_INPUT_BUFFER_PADDING_SIZE); AV_INPUT_BUFFER_PADDING_SIZE);
} }
} }
...@@ -600,11 +600,11 @@ void VideoDecoderConfigToAVCodecContext( ...@@ -600,11 +600,11 @@ void VideoDecoderConfigToAVCodecContext(
} else { } else {
codec_context->extradata_size = config.extra_data().size(); codec_context->extradata_size = config.extra_data().size();
codec_context->extradata = reinterpret_cast<uint8_t*>( 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], memcpy(codec_context->extradata, &config.extra_data()[0],
config.extra_data().size()); config.extra_data().size());
memset(codec_context->extradata + config.extra_data().size(), '\0', memset(codec_context->extradata + config.extra_data().size(), '\0',
FF_INPUT_BUFFER_PADDING_SIZE); AV_INPUT_BUFFER_PADDING_SIZE);
} }
} }
......
...@@ -24,22 +24,7 @@ ...@@ -24,22 +24,7 @@
// Include FFmpeg header files. // Include FFmpeg header files.
extern "C" { 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. // Temporarily disable possible loss of data warning.
// TODO(scherkus): fix and upstream the compiler warnings.
MSVC_PUSH_DISABLE_WARNING(4244); MSVC_PUSH_DISABLE_WARNING(4244);
#include <libavcodec/avcodec.h> #include <libavcodec/avcodec.h>
#include <libavformat/avformat.h> #include <libavformat/avformat.h>
......
...@@ -54,6 +54,7 @@ FFmpegDecodingLoop::DecodeStatus FFmpegDecodingLoop::DecodePacket( ...@@ -54,6 +54,7 @@ FFmpegDecodingLoop::DecodeStatus FFmpegDecodingLoop::DecodePacket(
if (!continue_on_decoding_errors_) if (!continue_on_decoding_errors_)
return DecodeStatus::kDecodeFrameFailed; return DecodeStatus::kDecodeFrameFailed;
decoder_error = true; decoder_error = true;
continue;
} }
const bool frame_processing_success = frame_ready_cb.Run(frame_.get()); const bool frame_processing_success = frame_ready_cb.Run(frame_.get());
......
...@@ -239,8 +239,9 @@ bool FFmpegAACBitstreamConverter::ConvertPacket(AVPacket* packet) { ...@@ -239,8 +239,9 @@ bool FFmpegAACBitstreamConverter::ConvertPacket(AVPacket* packet) {
// Release the old packet. // Release the old packet.
av_packet_unref(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; return true;
} }
......
...@@ -305,7 +305,6 @@ bool FFmpegAudioDecoder::ConfigureDecoder(const AudioDecoderConfig& config) { ...@@ -305,7 +305,6 @@ bool FFmpegAudioDecoder::ConfigureDecoder(const AudioDecoderConfig& config) {
codec_context_->opaque = this; codec_context_->opaque = this;
codec_context_->get_buffer2 = GetAudioBufferImpl; codec_context_->get_buffer2 = GetAudioBufferImpl;
codec_context_->refcounted_frames = 1;
if (!config.should_discard_decoder_delay()) if (!config.should_discard_decoder_delay())
codec_context_->flags2 |= AV_CODEC_FLAG2_SKIP_MANUAL; codec_context_->flags2 |= AV_CODEC_FLAG2_SKIP_MANUAL;
...@@ -353,7 +352,7 @@ void FFmpegAudioDecoder::ResetTimestampState(const AudioDecoderConfig& config) { ...@@ -353,7 +352,7 @@ void FFmpegAudioDecoder::ResetTimestampState(const AudioDecoderConfig& config) {
int FFmpegAudioDecoder::GetAudioBuffer(struct AVCodecContext* s, int FFmpegAudioDecoder::GetAudioBuffer(struct AVCodecContext* s,
AVFrame* frame, AVFrame* frame,
int flags) { 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); DCHECK_EQ(s->codec_type, AVMEDIA_TYPE_AUDIO);
// Since this routine is called by FFmpeg when a buffer is required for // Since this routine is called by FFmpeg when a buffer is required for
......
...@@ -920,7 +920,8 @@ TEST_F(FFmpegDemuxerTest, Read_DiscardDisabledVideoStream) { ...@@ -920,7 +920,8 @@ TEST_F(FFmpegDemuxerTest, Read_DiscardDisabledVideoStream) {
EXPECT_LT(bytes_read_with_video_disabled, bytes_read_with_video_enabled); 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 // 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 // enabled, then with the text track disabled. When the text track is
// disabled, FFmpegDemuxer sets the AVDISCARD_ALL flag on the corresponding // disabled, FFmpegDemuxer sets the AVDISCARD_ALL flag on the corresponding
...@@ -1123,11 +1124,11 @@ TEST_F(FFmpegDemuxerTest, SeekText) { ...@@ -1123,11 +1124,11 @@ TEST_F(FFmpegDemuxerTest, SeekText) {
base::RunLoop().Run(); base::RunLoop().Run();
// Text read #1. // Text read #1.
text_stream->Read(NewReadCB(FROM_HERE, 19, 500000, true)); text_stream->Read(NewReadCB(FROM_HERE, 19, 1000000, true));
base::RunLoop().Run(); base::RunLoop().Run();
// Text read #2. // Text read #2.
text_stream->Read(NewReadCB(FROM_HERE, 19, 1000000, true)); text_stream->Read(NewReadCB(FROM_HERE, 19, 1500000, true));
base::RunLoop().Run(); base::RunLoop().Run();
} }
......
...@@ -73,8 +73,9 @@ bool FFmpegH264ToAnnexBBitstreamConverter::ConvertPacket(AVPacket* packet) { ...@@ -73,8 +73,9 @@ bool FFmpegH264ToAnnexBBitstreamConverter::ConvertPacket(AVPacket* packet) {
// At the end we must destroy the old packet. // At the end we must destroy the old packet.
av_packet_unref(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; return true;
} }
......
...@@ -86,8 +86,9 @@ bool FFmpegH265ToAnnexBBitstreamConverter::ConvertPacket(AVPacket* packet) { ...@@ -86,8 +86,9 @@ bool FFmpegH265ToAnnexBBitstreamConverter::ConvertPacket(AVPacket* packet) {
// At the end we must destroy the old packet. // At the end we must destroy the old packet.
av_packet_unref(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; return true;
} }
......
...@@ -412,12 +412,10 @@ bool FFmpegVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config, ...@@ -412,12 +412,10 @@ bool FFmpegVideoDecoder::ConfigureDecoder(const VideoDecoderConfig& config,
codec_context_->thread_type = codec_context_->thread_type =
FF_THREAD_SLICE | (low_delay ? 0 : FF_THREAD_FRAME); FF_THREAD_SLICE | (low_delay ? 0 : FF_THREAD_FRAME);
codec_context_->opaque = this; codec_context_->opaque = this;
codec_context_->flags |= CODEC_FLAG_EMU_EDGE;
codec_context_->get_buffer2 = GetVideoBufferImpl; codec_context_->get_buffer2 = GetVideoBufferImpl;
codec_context_->refcounted_frames = 1;
if (decode_nalus_) 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); AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) { if (!codec || avcodec_open2(codec_context_.get(), codec, NULL) < 0) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment