summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--DEPS12
-rw-r--r--chrome/app/chrome.dll.deps4
-rw-r--r--chrome/tools/build/win/FILES.cfg4
-rw-r--r--chrome_frame/test/perf/chrome_frame_perftest.cc4
-rw-r--r--media/base/audio_decoder_config.h3
-rw-r--r--media/base/media_posix.cc6
-rw-r--r--media/base/media_win.cc6
-rw-r--r--media/ffmpeg/ffmpeg_common.cc38
-rw-r--r--media/ffmpeg/ffmpeg_common.h1
-rw-r--r--media/ffmpeg/ffmpeg_regression_tests.cc49
-rw-r--r--media/ffmpeg/ffmpeg_unittest.cc34
-rw-r--r--media/ffmpeg/file_protocol.cc3
-rw-r--r--media/filters/audio_file_reader.cc16
-rw-r--r--media/filters/ffmpeg_audio_decoder.cc2
-rw-r--r--media/filters/ffmpeg_demuxer.cc4
-rw-r--r--media/filters/ffmpeg_demuxer_unittest.cc8
-rw-r--r--media/filters/ffmpeg_glue.cc6
-rw-r--r--media/filters/ffmpeg_glue.h34
-rw-r--r--media/filters/ffmpeg_glue_unittest.cc4
-rw-r--r--media/filters/ffmpeg_video_decoder.cc4
-rw-r--r--media/filters/ffmpeg_video_decoder_unittest.cc2
-rw-r--r--media/test/ffmpeg_tests/ffmpeg_tests.cc15
-rw-r--r--media/tools/media_bench/media_bench.cc17
-rw-r--r--media/webm/webm_stream_parser.cc6
24 files changed, 126 insertions, 156 deletions
diff --git a/DEPS b/DEPS
index 0f4c458..87ab3df 100644
--- a/DEPS
+++ b/DEPS
@@ -41,12 +41,7 @@ vars = {
"libphonenumber_revision": "425",
"libvpx_revision": "122996",
"lss_revision": "9",
-
- # These two FFmpeg variables must be updated together. One is used for SVN
- # checkouts and the other for Git checkouts.
- "ffmpeg_revision": "123079",
- "ffmpeg_hash": "8a05b9314610683d837eec3b03306ca7a894bef7",
-
+ "ffmpeg_revision": "122092",
"sfntly_revision": "118",
"skia_revision": "3226",
# Three lines of non-changing comments so that
@@ -257,7 +252,7 @@ deps = {
Var("libvpx_revision"),
"src/third_party/ffmpeg":
- "/trunk/deps/third_party/ffmpeg@" +
+ "/trunk/deps/third_party/ffmpeg/source@" +
Var("ffmpeg_revision"),
"src/third_party/libjingle/source":
@@ -344,6 +339,9 @@ deps_os = {
"src/third_party/lighttpd":
"/trunk/deps/third_party/lighttpd@33727",
+ "src/third_party/ffmpeg/binaries/chromium/win/ia32":
+ "/trunk/deps/third_party/ffmpeg/binaries/win@" + Var("ffmpeg_revision"),
+
# Chrome Frame related deps
"src/third_party/xulrunner-sdk":
"/trunk/deps/third_party/xulrunner-sdk@119756",
diff --git a/chrome/app/chrome.dll.deps b/chrome/app/chrome.dll.deps
index f067d4b..376865d 100644
--- a/chrome/app/chrome.dll.deps
+++ b/chrome/app/chrome.dll.deps
@@ -31,8 +31,8 @@ delay_loaded = [
'dbghelp.dll',
'COMDLG32.dll',
'urlmon.dll',
- 'avcodec-54.dll',
- 'avformat-54.dll',
+ 'avcodec-53.dll',
+ 'avformat-53.dll',
'avutil-51.dll',
'pthreads.dll',
'IPHLPAPI.dll',
diff --git a/chrome/tools/build/win/FILES.cfg b/chrome/tools/build/win/FILES.cfg
index 9eba093..16e1fe6 100644
--- a/chrome/tools/build/win/FILES.cfg
+++ b/chrome/tools/build/win/FILES.cfg
@@ -25,12 +25,12 @@
FILES = [
{
- 'filename': 'avcodec-54.dll',
+ 'filename': 'avcodec-53.dll',
'arch': ['32bit', '64bit'],
'buildtype': ['dev', 'official'],
},
{
- 'filename': 'avformat-54.dll',
+ 'filename': 'avformat-53.dll',
'arch': ['32bit', '64bit'],
'buildtype': ['dev', 'official'],
},
diff --git a/chrome_frame/test/perf/chrome_frame_perftest.cc b/chrome_frame/test/perf/chrome_frame_perftest.cc
index d6421b2..14faa14 100644
--- a/chrome_frame/test/perf/chrome_frame_perftest.cc
+++ b/chrome_frame/test/perf/chrome_frame_perftest.cc
@@ -295,8 +295,8 @@ class ChromeFrameStartupTest : public ChromeFramePerfTestBase {
chrome_exe_ = dir_app_.Append(chrome::kBrowserProcessExecutableName);
chrome_frame_dll_ = dir_app_.Append(kChromeFrameDllName);
icu_dll_ = dir_app_.Append(L"icudt.dll");
- avcodec_dll_ = dir_app_.Append(L"avcodec-54.dll");
- avformat_dll_ = dir_app_.Append(L"avformat-54.dll");
+ avcodec_dll_ = dir_app_.Append(L"avcodec-53.dll");
+ avformat_dll_ = dir_app_.Append(L"avformat-53.dll");
avutil_dll_ = dir_app_.Append(L"avutil-51.dll");
}
diff --git a/media/base/audio_decoder_config.h b/media/base/audio_decoder_config.h
index 6e58c5b..90f51c1 100644
--- a/media/base/audio_decoder_config.h
+++ b/media/base/audio_decoder_config.h
@@ -35,9 +35,6 @@ enum AudioCodec {
kAudioCodecMax = kCodecPCM_MULAW // Must equal the last "real" codec above.
};
-// TODO(dalecurtis): FFmpeg API uses |bytes_per_channel| instead of
-// |bits_per_channel|, we should switch over since bits are generally confusing
-// to work with.
class MEDIA_EXPORT AudioDecoderConfig {
public:
// Constructs an uninitialized object. Clients should call Initialize() with
diff --git a/media/base/media_posix.cc b/media/base/media_posix.cc
index 52ad34f..7be3255 100644
--- a/media/base/media_posix.cc
+++ b/media/base/media_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -55,9 +55,9 @@ static std::string GetDSOName(tp_ffmpeg::StubModules stub_key) {
// TODO(ajwong): Remove this once mac is migrated. Either that, or have GYP
// set a constant that we can switch implementations based off of.
switch (stub_key) {
- case tp_ffmpeg::kModuleAvcodec54:
+ case tp_ffmpeg::kModuleAvcodec53:
return FILE_PATH_LITERAL(DSO_NAME("avcodec", AVCODEC_VERSION));
- case tp_ffmpeg::kModuleAvformat54:
+ case tp_ffmpeg::kModuleAvformat53:
return FILE_PATH_LITERAL(DSO_NAME("avformat", AVFORMAT_VERSION));
case tp_ffmpeg::kModuleAvutil51:
return FILE_PATH_LITERAL(DSO_NAME("avutil", AVUTIL_VERSION));
diff --git a/media/base/media_win.cc b/media/base/media_win.cc
index e8c0368..9462c02 100644
--- a/media/base/media_win.cc
+++ b/media/base/media_win.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -25,9 +25,9 @@ static FilePath::CharType* GetDLLName(FFmpegDLLKeys dll_key) {
// TODO(ajwong): Do we want to lock to a specific ffmpeg version?
switch (dll_key) {
case FILE_LIBAVCODEC:
- return FILE_PATH_LITERAL("avcodec-54.dll");
+ return FILE_PATH_LITERAL("avcodec-53.dll");
case FILE_LIBAVFORMAT:
- return FILE_PATH_LITERAL("avformat-54.dll");
+ return FILE_PATH_LITERAL("avformat-53.dll");
case FILE_LIBAVUTIL:
return FILE_PATH_LITERAL("avutil-51.dll");
default:
diff --git a/media/ffmpeg/ffmpeg_common.cc b/media/ffmpeg/ffmpeg_common.cc
index 978aff0..4fc7f4e 100644
--- a/media/ffmpeg/ffmpeg_common.cc
+++ b/media/ffmpeg/ffmpeg_common.cc
@@ -178,14 +178,14 @@ void AVCodecContextToAudioDecoderConfig(
DCHECK_EQ(codec_context->codec_type, AVMEDIA_TYPE_AUDIO);
AudioCodec codec = CodecIDToAudioCodec(codec_context->codec_id);
- int bytes_per_channel = av_get_bytes_per_sample(codec_context->sample_fmt);
+ int bits_per_channel = av_get_bits_per_sample_fmt(codec_context->sample_fmt);
ChannelLayout channel_layout =
ChannelLayoutToChromeChannelLayout(codec_context->channel_layout,
codec_context->channels);
int samples_per_second = codec_context->sample_rate;
config->Initialize(codec,
- bytes_per_channel << 3,
+ bits_per_channel,
channel_layout,
samples_per_second,
codec_context->extradata,
@@ -289,35 +289,35 @@ void VideoDecoderConfigToAVCodecContext(
ChannelLayout ChannelLayoutToChromeChannelLayout(int64_t layout,
int channels) {
switch (layout) {
- case AV_CH_LAYOUT_MONO:
+ case CH_LAYOUT_MONO:
return CHANNEL_LAYOUT_MONO;
- case AV_CH_LAYOUT_STEREO:
+ case CH_LAYOUT_STEREO:
return CHANNEL_LAYOUT_STEREO;
- case AV_CH_LAYOUT_2_1:
+ case CH_LAYOUT_2_1:
return CHANNEL_LAYOUT_2_1;
- case AV_CH_LAYOUT_SURROUND:
+ case CH_LAYOUT_SURROUND:
return CHANNEL_LAYOUT_SURROUND;
- case AV_CH_LAYOUT_4POINT0:
+ case CH_LAYOUT_4POINT0:
return CHANNEL_LAYOUT_4POINT0;
- case AV_CH_LAYOUT_2_2:
+ case CH_LAYOUT_2_2:
return CHANNEL_LAYOUT_2_2;
- case AV_CH_LAYOUT_QUAD:
+ case CH_LAYOUT_QUAD:
return CHANNEL_LAYOUT_QUAD;
- case AV_CH_LAYOUT_5POINT0:
+ case CH_LAYOUT_5POINT0:
return CHANNEL_LAYOUT_5POINT0;
- case AV_CH_LAYOUT_5POINT1:
+ case CH_LAYOUT_5POINT1:
return CHANNEL_LAYOUT_5POINT1;
- case AV_CH_LAYOUT_5POINT0_BACK:
+ case CH_LAYOUT_5POINT0_BACK:
return CHANNEL_LAYOUT_5POINT0_BACK;
- case AV_CH_LAYOUT_5POINT1_BACK:
+ case CH_LAYOUT_5POINT1_BACK:
return CHANNEL_LAYOUT_5POINT1_BACK;
- case AV_CH_LAYOUT_7POINT0:
+ case CH_LAYOUT_7POINT0:
return CHANNEL_LAYOUT_7POINT0;
- case AV_CH_LAYOUT_7POINT1:
+ case CH_LAYOUT_7POINT1:
return CHANNEL_LAYOUT_7POINT1;
- case AV_CH_LAYOUT_7POINT1_WIDE:
+ case CH_LAYOUT_7POINT1_WIDE:
return CHANNEL_LAYOUT_7POINT1_WIDE;
- case AV_CH_LAYOUT_STEREO_DOWNMIX:
+ case CH_LAYOUT_STEREO_DOWNMIX:
return CHANNEL_LAYOUT_STEREO_DOWNMIX;
default:
// FFmpeg channel_layout is 0 for .wav and .mp3. We know mono and stereo
@@ -376,7 +376,7 @@ void DestroyAVFormatContext(AVFormatContext* format_context) {
// 1. AVStream is alive.
// 2. AVCodecContext in AVStream is alive.
// 3. AVCodec in AVCodecContext is alive.
- // Notice that closing a codec context without prior avcodec_open2() will
+ // Notice that closing a codec context without prior avcodec_open() will
// result in a crash in FFmpeg.
if (stream && stream->codec && stream->codec->codec) {
stream->discard = AVDISCARD_ALL;
@@ -386,7 +386,7 @@ void DestroyAVFormatContext(AVFormatContext* format_context) {
}
// Then finally cleanup the format context.
- avformat_close_input(&format_context);
+ av_close_input_file(format_context);
}
} // namespace media
diff --git a/media/ffmpeg/ffmpeg_common.h b/media/ffmpeg/ffmpeg_common.h
index 22ddb7c..6ebd5fa 100644
--- a/media/ffmpeg/ffmpeg_common.h
+++ b/media/ffmpeg/ffmpeg_common.h
@@ -22,7 +22,6 @@ MSVC_PUSH_DISABLE_WARNING(4244);
#include <libavcodec/avcodec.h>
#include <libavformat/avformat.h>
#include <libavformat/avio.h>
-#include <libavformat/url.h>
#include <libavutil/avutil.h>
#include <libavutil/mathematics.h>
#include <libavutil/log.h>
diff --git a/media/ffmpeg/ffmpeg_regression_tests.cc b/media/ffmpeg/ffmpeg_regression_tests.cc
index 9b7d2dd..8df6c10 100644
--- a/media/ffmpeg/ffmpeg_regression_tests.cc
+++ b/media/ffmpeg/ffmpeg_regression_tests.cc
@@ -1,18 +1,6 @@
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-//
-// Regression tests for FFmpeg. Security test files can be found in the
-// internal media test data directory:
-//
-// svn://svn.chromium.org/chrome-internal/trunk/data/media/security/
-//
-// Simply symlink or copy the security directory into media/test/data folder and
-// build the ffmpeg_regression_tests target to run these tests.
-//
-// Many of the files here do not cause issues outside of tooling, so you'll need
-// to run this test under ASAN, TSAN, and Valgrind to ensure that all issues are
-// caught.
#include "media/filters/pipeline_integration_test_base.h"
@@ -48,6 +36,8 @@ class FFmpegRegressionTest
// Test cases from issues.
FFMPEG_TEST_CASE(Cr93620, "security/93620.ogg", PIPELINE_OK, PIPELINE_OK);
+FFMPEG_TEST_CASE(Cr99652, "security/99652.webm", PIPELINE_OK,
+ PIPELINE_ERROR_DECODE);
FFMPEG_TEST_CASE(Cr100492, "security/100492.webm", DECODER_ERROR_NOT_SUPPORTED,
DECODER_ERROR_NOT_SUPPORTED);
FFMPEG_TEST_CASE(Cr100543, "security/100543.webm", PIPELINE_OK, PIPELINE_OK);
@@ -82,12 +72,19 @@ FFMPEG_TEST_CASE(MP4_9, "security/smclockmp4aac_1_0.mp4",
DEMUXER_ERROR_COULD_NOT_OPEN, DEMUXER_ERROR_COULD_NOT_OPEN);
// General OGV test cases.
+FFMPEG_TEST_CASE(OGV_0, "security/big_dims.ogv", PIPELINE_ERROR_DECODE,
+ PIPELINE_ERROR_DECODE);
FFMPEG_TEST_CASE(OGV_1, "security/out.163.ogv", DECODER_ERROR_NOT_SUPPORTED,
DECODER_ERROR_NOT_SUPPORTED);
FFMPEG_TEST_CASE(OGV_2, "security/out.391.ogv", DECODER_ERROR_NOT_SUPPORTED,
DECODER_ERROR_NOT_SUPPORTED);
+FFMPEG_TEST_CASE(OGV_3, "security/smclock_1_0.ogv", PIPELINE_OK, PIPELINE_OK);
+FFMPEG_TEST_CASE(OGV_4, "security/smclock.ogv.1.0.ogv", PIPELINE_OK,
+ PIPELINE_OK);
FFMPEG_TEST_CASE(OGV_5, "security/smclocktheora_1_0.ogv",
DECODER_ERROR_NOT_SUPPORTED, DECODER_ERROR_NOT_SUPPORTED);
+FFMPEG_TEST_CASE(OGV_6, "security/smclocktheora_1_10000.ogv",
+ PIPELINE_ERROR_DECODE, PIPELINE_ERROR_DECODE);
FFMPEG_TEST_CASE(OGV_7, "security/smclocktheora_1_102.ogv",
DECODER_ERROR_NOT_SUPPORTED, DECODER_ERROR_NOT_SUPPORTED);
FFMPEG_TEST_CASE(OGV_8, "security/smclocktheora_1_104.ogv",
@@ -100,16 +97,14 @@ FFMPEG_TEST_CASE(OGV_11, "security/smclocktheora_1_20.ogv",
DECODER_ERROR_NOT_SUPPORTED, DECODER_ERROR_NOT_SUPPORTED);
FFMPEG_TEST_CASE(OGV_12, "security/smclocktheora_1_723.ogv",
DECODER_ERROR_NOT_SUPPORTED, DECODER_ERROR_NOT_SUPPORTED);
+FFMPEG_TEST_CASE(OGV_13, "security/smclocktheora_1_790.ogv", PIPELINE_OK,
+ PIPELINE_OK);
FFMPEG_TEST_CASE(OGV_14, "security/smclocktheora_2_10405.ogv",
DECODER_ERROR_NOT_SUPPORTED, DECODER_ERROR_NOT_SUPPORTED);
-FFMPEG_TEST_CASE(OGV_15, "security/smclocktheora_2_10619.ogv",
- DECODER_ERROR_NOT_SUPPORTED, DECODER_ERROR_NOT_SUPPORTED);
FFMPEG_TEST_CASE(OGV_16, "security/smclocktheora_2_1075.ogv",
DECODER_ERROR_NOT_SUPPORTED, DECODER_ERROR_NOT_SUPPORTED);
FFMPEG_TEST_CASE(OGV_17, "security/vorbis.482086.ogv",
DECODER_ERROR_NOT_SUPPORTED, DECODER_ERROR_NOT_SUPPORTED);
-FFMPEG_TEST_CASE(OGV_18, "security/wav.711.ogv", DECODER_ERROR_NOT_SUPPORTED,
- DECODER_ERROR_NOT_SUPPORTED);
// General WebM test cases.
FFMPEG_TEST_CASE(WEBM_1, "security/no-bug.webm", PIPELINE_OK, PIPELINE_OK);
@@ -120,25 +115,15 @@ FFMPEG_TEST_CASE(WEBM_3, "security/out.webm.139771.2965",
FFMPEG_TEST_CASE(WEBM_4, "security/out.webm.68798.1929",
DECODER_ERROR_NOT_SUPPORTED, DECODER_ERROR_NOT_SUPPORTED);
-// Flaky, maybe larger issues. All eventually fail in the browser.
-FFMPEG_TEST_CASE(FLAKY_Cr99652, "security/99652.webm", PIPELINE_OK,
- PIPELINE_ERROR_DECODE);
-FFMPEG_TEST_CASE(FLAKY_Cr100464, "security/100464.webm", PIPELINE_OK,
- PIPELINE_ERROR_DECODE);
-FFMPEG_TEST_CASE(FLAKY_Cr111342, "security/111342.ogm", PIPELINE_OK,
+// Flaky, maybe larger issues.
+FFMPEG_TEST_CASE(Cr100464, "security/100464.webm", PIPELINE_OK,
PIPELINE_ERROR_DECODE);
-FFMPEG_TEST_CASE(FLAKY_OGV_0, "security/big_dims.ogv", PIPELINE_OK,
- PIPELINE_ERROR_DECODE);
-FFMPEG_TEST_CASE(FLAKY_OGV_3, "security/smclock_1_0.ogv", PIPELINE_ERROR_DECODE,
- PIPELINE_ERROR_DECODE);
-FFMPEG_TEST_CASE(FLAKY_OGV_4, "security/smclock.ogv.1.0.ogv",
- PIPELINE_OK, PIPELINE_ERROR_DECODE);
-FFMPEG_TEST_CASE(FLAKY_OGV_6, "security/smclocktheora_1_10000.ogv",
- PIPELINE_OK, PIPELINE_ERROR_DECODE);
-FFMPEG_TEST_CASE(FLAKY_OGV_13, "security/smclocktheora_1_790.ogv",
- PIPELINE_ERROR_DECODE, PIPELINE_ERROR_DECODE);
// Current crashers.
+// FFMPEG_TEST_CASE(Cr111342, "security/111342.ogm", PIPELINE_OK, PIPELINE_OK);
+// FFMPEG_TEST_CASE(OGV_15, "security/smclocktheora_2_10619.ogv",
+// DECODER_ERROR_NOT_SUPPORTED, DECODER_ERROR_NOT_SUPPORTED);
+// FFMPEG_TEST_CASE(OGV_18, "security/wav.711.ogv", PIPELINE_OK, PIPELINE_OK);
// FFMPEG_TEST_CASE(Cr112976, "security/112976.ogg", PIPELINE_OK, PIPELINE_OK);
// Clock failures. http://crbug.com/113037
diff --git a/media/ffmpeg/ffmpeg_unittest.cc b/media/ffmpeg/ffmpeg_unittest.cc
index 121f0a6..9e377aa 100644
--- a/media/ffmpeg/ffmpeg_unittest.cc
+++ b/media/ffmpeg/ffmpeg_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -46,9 +46,6 @@ int main(int argc, char** argv) {
namespace media {
-// Mirror setting in ffmpeg_video_decoder.
-static const int kDecodeThreads = 2;
-
class AVPacketQueue {
public:
AVPacketQueue() {
@@ -90,8 +87,6 @@ class AVPacketQueue {
DISALLOW_COPY_AND_ASSIGN(AVPacketQueue);
};
-// TODO(dalecurtis): We should really just use PipelineIntegrationTests instead
-// of a one-off step decoder so we're exercising the real pipeline.
class FFmpegTest : public testing::TestWithParam<const char*> {
protected:
FFmpegTest()
@@ -138,18 +133,18 @@ class FFmpegTest : public testing::TestWithParam<const char*> {
std::string ascii_path = path.value();
#endif
- EXPECT_EQ(0, avformat_open_input(&av_format_context_,
- ascii_path.c_str(),
- NULL, NULL))
+ EXPECT_EQ(0, av_open_input_file(&av_format_context_,
+ ascii_path.c_str(),
+ NULL, 0, NULL))
<< "Could not open " << path.value();
- EXPECT_LE(0, avformat_find_stream_info(av_format_context_, NULL))
+ EXPECT_LE(0, av_find_stream_info(av_format_context_))
<< "Could not find stream information for " << path.value();
// Determine duration by picking max stream duration.
for (unsigned int i = 0; i < av_format_context_->nb_streams; ++i) {
AVStream* av_stream = av_format_context_->streams[i];
- int64 duration = ConvertFromTimeBase(
- av_stream->time_base, av_stream->duration).InMicroseconds();
+ int64 duration = ConvertFromTimeBase(av_stream->time_base,
+ av_stream->duration).InMicroseconds();
duration_ = std::max(duration_, duration);
}
@@ -157,12 +152,12 @@ class FFmpegTest : public testing::TestWithParam<const char*> {
AVRational av_time_base = {1, AV_TIME_BASE};
int64 duration =
ConvertFromTimeBase(av_time_base,
- av_format_context_->duration).InMicroseconds();
+ av_format_context_->duration).InMicroseconds();
duration_ = std::max(duration_, duration);
}
void CloseFile() {
- avformat_close_input(&av_format_context_);
+ av_close_input_file(av_format_context_);
}
void OpenCodecs() {
@@ -174,13 +169,7 @@ class FFmpegTest : public testing::TestWithParam<const char*> {
EXPECT_TRUE(av_codec)
<< "Could not find AVCodec with CodecID "
<< av_codec_context->codec_id;
-
- av_codec_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
- av_codec_context->err_recognition = AV_EF_CAREFUL;
- av_codec_context->thread_count = (
- av_codec_context->codec_id == CODEC_ID_THEORA ? 1 : kDecodeThreads);
-
- EXPECT_EQ(0, avcodec_open2(av_codec_context, av_codec, NULL))
+ EXPECT_EQ(0, avcodec_open(av_codec_context, av_codec))
<< "Could not open AVCodecContext with CodecID "
<< av_codec_context->codec_id;
@@ -282,7 +271,7 @@ class FFmpegTest : public testing::TestWithParam<const char*> {
if (result > 0) {
// TODO(scherkus): move this to ffmpeg_common.h and dedup.
int64 denominator = av_audio_context()->channels *
- av_get_bytes_per_sample(av_audio_context()->sample_fmt) *
+ av_get_bits_per_sample_fmt(av_audio_context()->sample_fmt) / 8 *
av_audio_context()->sample_rate;
double microseconds = size_out /
(denominator /
@@ -413,6 +402,7 @@ class FFmpegTest : public testing::TestWithParam<const char*> {
EXPECT_TRUE(InitializeMediaLibrary(path))
<< "Could not initialize media library.";
+ avcodec_init();
av_log_set_level(AV_LOG_FATAL);
av_register_all();
av_register_protocol2(&kFFmpegFileProtocol, sizeof(kFFmpegFileProtocol));
diff --git a/media/ffmpeg/file_protocol.cc b/media/ffmpeg/file_protocol.cc
index 49b9f1c..26ba8ce 100644
--- a/media/ffmpeg/file_protocol.cc
+++ b/media/ffmpeg/file_protocol.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -78,7 +78,6 @@ MSVC_POP_WARNING()
URLProtocol kFFmpegFileProtocol = {
"file",
&OpenContext,
- NULL, // url_open2
&ReadContext,
&WriteContext,
&SeekContext,
diff --git a/media/filters/audio_file_reader.cc b/media/filters/audio_file_reader.cc
index 138d89e..bf26aff 100644
--- a/media/filters/audio_file_reader.cc
+++ b/media/filters/audio_file_reader.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -51,15 +51,15 @@ bool AudioFileReader::Open() {
DCHECK(!format_context_);
AVFormatContext* context = NULL;
- int result = avformat_open_input(&context, key.c_str(), NULL, NULL);
+ int result = av_open_input_file(&context, key.c_str(), NULL, 0, NULL);
- // Remove our data reader from protocol list since avformat_open_input() setup
+ // Remove our data reader from protocol list since av_open_input_file() setup
// the AVFormatContext with the data reader.
FFmpegGlue::GetInstance()->RemoveProtocol(protocol_);
if (result) {
DLOG(WARNING)
- << "AudioFileReader::Open() : error in avformat_open_input() -"
+ << "AudioFileReader::Open() : error in av_open_input_file() -"
<< " result: " << result;
return false;
}
@@ -81,10 +81,10 @@ bool AudioFileReader::Open() {
if (!codec_context_)
return false;
- avformat_find_stream_info(format_context_, NULL);
+ av_find_stream_info(format_context_);
codec_ = avcodec_find_decoder(codec_context_->codec_id);
if (codec_) {
- if ((result = avcodec_open2(codec_context_, codec_, NULL)) < 0) {
+ if ((result = avcodec_open(codec_context_, codec_)) < 0) {
DLOG(WARNING) << "AudioFileReader::Open() : could not open codec -"
<< " result: " << result;
return false;
@@ -112,7 +112,7 @@ void AudioFileReader::Close() {
codec_ = NULL;
if (format_context_) {
- avformat_close_input(&format_context_);
+ av_close_input_file(format_context_);
format_context_ = NULL;
}
}
@@ -157,7 +157,7 @@ bool AudioFileReader::Read(const std::vector<float*>& audio_data,
// Determine the number of sample-frames we just decoded.
size_t bytes_per_sample =
- av_get_bytes_per_sample(codec_context_->sample_fmt);
+ av_get_bits_per_sample_fmt(codec_context_->sample_fmt) >> 3;
size_t frames_read = out_size / (channels * bytes_per_sample);
// Truncate, if necessary, if the destination isn't big enough.
diff --git a/media/filters/ffmpeg_audio_decoder.cc b/media/filters/ffmpeg_audio_decoder.cc
index acb0d75..b794cd9 100644
--- a/media/filters/ffmpeg_audio_decoder.cc
+++ b/media/filters/ffmpeg_audio_decoder.cc
@@ -127,7 +127,7 @@ void FFmpegAudioDecoder::DoInitialize(
AudioDecoderConfigToAVCodecContext(config, codec_context_);
AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
- if (!codec || avcodec_open2(codec_context_, codec, NULL) < 0) {
+ if (!codec || avcodec_open(codec_context_, codec) < 0) {
DLOG(ERROR) << "Could not initialize audio decoder: "
<< codec_context_->codec_id;
diff --git a/media/filters/ffmpeg_demuxer.cc b/media/filters/ffmpeg_demuxer.cc
index 5dc5ce7..0cb2ea4 100644
--- a/media/filters/ffmpeg_demuxer.cc
+++ b/media/filters/ffmpeg_demuxer.cc
@@ -465,7 +465,7 @@ void FFmpegDemuxer::InitializeTask(DataSource* data_source,
// Open FFmpeg AVFormatContext.
DCHECK(!format_context_);
AVFormatContext* context = NULL;
- int result = avformat_open_input(&context, key.c_str(), NULL, NULL);
+ int result = av_open_input_file(&context, key.c_str(), NULL, 0, NULL);
// Remove ourself from protocol list.
FFmpegGlue::GetInstance()->RemoveProtocol(this);
@@ -479,7 +479,7 @@ void FFmpegDemuxer::InitializeTask(DataSource* data_source,
format_context_ = context;
// Fully initialize AVFormatContext by parsing the stream a little.
- result = avformat_find_stream_info(format_context_, NULL);
+ result = av_find_stream_info(format_context_);
if (result < 0) {
callback.Run(DEMUXER_ERROR_COULD_NOT_PARSE);
return;
diff --git a/media/filters/ffmpeg_demuxer_unittest.cc b/media/filters/ffmpeg_demuxer_unittest.cc
index d15d8ec..45838f6 100644
--- a/media/filters/ffmpeg_demuxer_unittest.cc
+++ b/media/filters/ffmpeg_demuxer_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -144,7 +144,7 @@ class FFmpegDemuxerTest : public testing::Test {
};
TEST_F(FFmpegDemuxerTest, Initialize_OpenFails) {
- // Simulate avformat_open_input() failing.
+ // Simulate av_open_input_file() failing.
EXPECT_CALL(host_, SetCurrentReadPosition(_));
demuxer_->Initialize(CreateDataSource("ten_byte_file"),
NewExpectedStatusCB(DEMUXER_ERROR_COULD_NOT_OPEN));
@@ -153,7 +153,7 @@ TEST_F(FFmpegDemuxerTest, Initialize_OpenFails) {
}
// TODO(acolwell): Uncomment this test when we discover a file that passes
-// avformat_open_input(), but has avformat_find_stream_info() fail.
+// av_open_input_file(), but has av_find_stream_info() fail.
//
//TEST_F(FFmpegDemuxerTest, Initialize_ParseFails) {
// demuxer_->Initialize(
@@ -639,7 +639,7 @@ TEST_F(FFmpegDemuxerTest, GetBitrate_SetInContainer_NoFileSize) {
}
TEST_F(FFmpegDemuxerTest, GetBitrate_UnsetInContainer_NoFileSize) {
- EXPECT_TRUE(VideoHasValidBitrate("bear-320x240.webm", true));
+ EXPECT_FALSE(VideoHasValidBitrate("bear-320x240.webm", true));
}
TEST_F(FFmpegDemuxerTest, ProtocolGetSetPosition) {
diff --git a/media/filters/ffmpeg_glue.cc b/media/filters/ffmpeg_glue.cc
index 5177462..bd55901 100644
--- a/media/filters/ffmpeg_glue.cc
+++ b/media/filters/ffmpeg_glue.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -23,7 +23,7 @@ static int OpenContext(URLContext* h, const char* filename, int flags) {
return AVERROR(EIO);
h->priv_data = protocol;
- h->flags = AVIO_FLAG_READ;
+ h->flags = URL_RDONLY;
h->is_streamed = protocol->IsStreaming();
return 0;
}
@@ -118,7 +118,6 @@ static const char kProtocol[] = "http";
static URLProtocol kFFmpegURLProtocol = {
kProtocol,
&OpenContext,
- NULL, // url_open2
&ReadContext,
&WriteContext,
&SeekContext,
@@ -130,6 +129,7 @@ FFmpegGlue::FFmpegGlue() {
av_log_set_level(AV_LOG_QUIET);
// Register our protocol glue code with FFmpeg.
+ avcodec_init();
av_register_protocol2(&kFFmpegURLProtocol, sizeof(kFFmpegURLProtocol));
av_lockmgr_register(&LockManagerOperation);
diff --git a/media/filters/ffmpeg_glue.h b/media/filters/ffmpeg_glue.h
index 4e122a6..257915e 100644
--- a/media/filters/ffmpeg_glue.h
+++ b/media/filters/ffmpeg_glue.h
@@ -1,27 +1,27 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
// FFmpegGlue is an adapter for FFmpeg's URLProtocol interface that allows us to
-// use a DataSource implementation with FFmpeg. For convenience we use FFmpeg's
-// avformat_open_input() function, which analyzes the filename given to it and
+// use a DataSource implementation with FFmpeg. For convenience we use FFmpeg's
+// av_open_input_file function, which analyzes the filename given to it and
// automatically initializes the appropriate URLProtocol.
//
-// Since the DataSource is already open by time we call avformat_open_input(),
-// we need a way for avformat_open_input() to find the correct DataSource
-// instance. The solution is to maintain a map of "filenames" to DataSource
-// instances, where filenames are actually just a unique identifier. For
-// simplicity, FFmpegGlue is registered as an HTTP handler and generates
-// filenames based on the memory address of the DataSource, i.e.,
-// http://0xc0bf4870. Since there may be multiple FFmpegDemuxers active at one
-// time, FFmpegGlue is a thread-safe singleton.
+// Since the DataSource is already open by time we call av_open_input_file, we
+// need a way for av_open_input_file to find the correct DataSource instance.
+// The solution is to maintain a map of "filenames" to DataSource instances,
+// where filenames are actually just a unique identifier. For simplicity,
+// FFmpegGlue is registered as an HTTP handler and generates filenames based on
+// the memory address of the DataSource, i.e., http://0xc0bf4870. Since there
+// may be multiple FFmpegDemuxers active at one time, FFmpegGlue is a
+// thread-safe singleton.
//
// Usage: FFmpegDemuxer adds the DataSource to FFmpegGlue's map and is given a
-// filename to pass to avformat_open_input(). FFmpegDemuxer calls
-// avformat_open_input() with the filename, which results in FFmpegGlue
-// returning the DataSource as a URLProtocol instance to FFmpeg. Since
-// FFmpegGlue is only needed for opening files, when avformat_open_input()
-// returns FFmpegDemuxer removes the DataSource from FFmpegGlue's map.
+// filename to pass to av_open_input_file. FFmpegDemuxer calls
+// av_open_input_file with the filename, which results in FFmpegGlue returning
+// the DataSource as a URLProtocol instance to FFmpeg. Since FFmpegGlue is only
+// needed for opening files, when av_open_input_file returns FFmpegDemuxer
+// removes the DataSource from FFmpegGlue's map.
#ifndef MEDIA_FILTERS_FFMPEG_GLUE_H_
#define MEDIA_FILTERS_FFMPEG_GLUE_H_
@@ -90,7 +90,7 @@ class MEDIA_EXPORT FFmpegGlue {
virtual ~FFmpegGlue();
// Returns the unique key for this data source, which can be passed to
- // avformat_open_input() as the filename.
+ // av_open_input_file as the filename.
std::string GetProtocolKey(FFmpegURLProtocol* protocol);
// Mutual exclusion while adding/removing items from the map.
diff --git a/media/filters/ffmpeg_glue_unittest.cc b/media/filters/ffmpeg_glue_unittest.cc
index 8fded22..94258e9 100644
--- a/media/filters/ffmpeg_glue_unittest.cc
+++ b/media/filters/ffmpeg_glue_unittest.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -154,7 +154,7 @@ TEST_F(FFmpegGlueTest, OpenClose) {
// Test opening a URLContext with our protocol.
EXPECT_EQ(0, protocol_->url_open(&context, key.c_str(), 0));
- EXPECT_EQ(AVIO_FLAG_READ, context.flags);
+ EXPECT_EQ(URL_RDONLY, context.flags);
EXPECT_EQ(protocol.get(), context.priv_data);
EXPECT_TRUE(context.is_streamed);
diff --git a/media/filters/ffmpeg_video_decoder.cc b/media/filters/ffmpeg_video_decoder.cc
index 61932ff..7ca0d1d 100644
--- a/media/filters/ffmpeg_video_decoder.cc
+++ b/media/filters/ffmpeg_video_decoder.cc
@@ -101,7 +101,7 @@ void FFmpegVideoDecoder::Initialize(DemuxerStream* demuxer_stream,
// Enable motion vector search (potentially slow), strong deblocking filter
// for damaged macroblocks, and set our error detection sensitivity.
codec_context_->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
- codec_context_->err_recognition = AV_EF_CAREFUL;
+ codec_context_->error_recognition = FF_ER_CAREFUL;
codec_context_->thread_count = GetThreadCount(codec_context_->codec_id);
AVCodec* codec = avcodec_find_decoder(codec_context_->codec_id);
@@ -110,7 +110,7 @@ void FFmpegVideoDecoder::Initialize(DemuxerStream* demuxer_stream,
return;
}
- if (avcodec_open2(codec_context_, codec, NULL) < 0) {
+ if (avcodec_open(codec_context_, codec) < 0) {
callback.Run(PIPELINE_ERROR_DECODE);
return;
}
diff --git a/media/filters/ffmpeg_video_decoder_unittest.cc b/media/filters/ffmpeg_video_decoder_unittest.cc
index 939e689..83a754e 100644
--- a/media/filters/ffmpeg_video_decoder_unittest.cc
+++ b/media/filters/ffmpeg_video_decoder_unittest.cc
@@ -238,7 +238,7 @@ TEST_F(FFmpegVideoDecoderTest, Initialize_UnsupportedPixelFormat) {
}
TEST_F(FFmpegVideoDecoderTest, Initialize_OpenDecoderFails) {
- // Specify Theora w/o extra data so that avcodec_open2() fails.
+ // Specify Theora w/o extra data so that avcodec_open() fails.
VideoDecoderConfig config(kCodecTheora, VIDEO_CODEC_PROFILE_UNKNOWN,
kVideoFormat,
kCodedSize, kVisibleRect,
diff --git a/media/test/ffmpeg_tests/ffmpeg_tests.cc b/media/test/ffmpeg_tests/ffmpeg_tests.cc
index 73b69f4..90cf45e 100644
--- a/media/test/ffmpeg_tests/ffmpeg_tests.cc
+++ b/media/test/ffmpeg_tests/ffmpeg_tests.cc
@@ -114,11 +114,12 @@ int main(int argc, const char** argv) {
#endif
// Register FFmpeg and attempt to open file.
+ avcodec_init();
av_log_set_level(verbose_level);
av_register_all();
av_register_protocol2(&kFFmpegFileProtocol, sizeof(kFFmpegFileProtocol));
AVFormatContext* format_context = NULL;
- // avformat_open_input() wants a char*, which can't work with wide paths.
+ // av_open_input_file wants a char*, which can't work with wide paths.
// So we assume ASCII on Windows. On other platforms we can pass the
// path bytes through verbatim.
#if defined(OS_WIN)
@@ -126,8 +127,8 @@ int main(int argc, const char** argv) {
#else
const std::string& string_path = in_path.value();
#endif
- int result = avformat_open_input(&format_context, string_path.c_str(),
- NULL, NULL);
+ int result = av_open_input_file(&format_context, string_path.c_str(),
+ NULL, 0, NULL);
if (result < 0) {
switch (result) {
case AVERROR(EINVAL):
@@ -154,7 +155,7 @@ int main(int argc, const char** argv) {
}
// Parse a little bit of the stream to fill out the format context.
- if (avformat_find_stream_info(format_context, NULL) < 0) {
+ if (av_find_stream_info(format_context) < 0) {
std::cerr << "Error: Could not find stream info for "
<< in_path.value() << std::endl;
return 1;
@@ -229,7 +230,7 @@ int main(int argc, const char** argv) {
}
codec_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
- codec_context->err_recognition = AV_EF_CAREFUL;
+ codec_context->error_recognition = FF_ER_CAREFUL;
// Initialize threaded decode.
if (target_codec == AVMEDIA_TYPE_VIDEO && video_threads > 0) {
@@ -237,7 +238,7 @@ int main(int argc, const char** argv) {
}
// Initialize our codec.
- if (avcodec_open2(codec_context, codec, NULL) < 0) {
+ if (avcodec_open(codec_context, codec) < 0) {
std::cerr << "Error: Could not open codec "
<< codec_context->codec->name << " for "
<< in_path.value() << std::endl;
@@ -420,7 +421,7 @@ int main(int argc, const char** argv) {
if (codec_context)
avcodec_close(codec_context);
if (format_context)
- avformat_close_input(&format_context);
+ av_close_input_file(format_context);
// Calculate the sum of times. Note that some of these may be zero.
double sum = 0;
diff --git a/media/tools/media_bench/media_bench.cc b/media/tools/media_bench/media_bench.cc
index 532aa7d..fc732bf 100644
--- a/media/tools/media_bench/media_bench.cc
+++ b/media/tools/media_bench/media_bench.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -228,11 +228,12 @@ int main(int argc, const char** argv) {
#endif
// Register FFmpeg and attempt to open file.
+ avcodec_init();
av_log_set_level(verbose_level);
av_register_all();
av_register_protocol2(&kFFmpegFileProtocol, sizeof(kFFmpegFileProtocol));
AVFormatContext* format_context = NULL;
- // avformat_open_input() wants a char*, which can't work with wide paths.
+ // av_open_input_file wants a char*, which can't work with wide paths.
// So we assume ASCII on Windows. On other platforms we can pass the
// path bytes through verbatim.
#if defined(OS_WIN)
@@ -240,8 +241,8 @@ int main(int argc, const char** argv) {
#else
const std::string& string_path = in_path.value();
#endif
- int result = avformat_open_input(&format_context, string_path.c_str(),
- NULL, NULL);
+ int result = av_open_input_file(&format_context, string_path.c_str(),
+ NULL, 0, NULL);
if (result < 0) {
switch (result) {
case AVERROR(EINVAL):
@@ -278,7 +279,7 @@ int main(int argc, const char** argv) {
}
// Parse a little bit of the stream to fill out the format context.
- if (avformat_find_stream_info(format_context, NULL) < 0) {
+ if (av_find_stream_info(format_context) < 0) {
std::cerr << "Error: Could not find stream info for "
<< in_path.value() << std::endl;
return 1;
@@ -340,7 +341,7 @@ int main(int argc, const char** argv) {
}
if (error_correction) {
codec_context->error_concealment = FF_EC_GUESS_MVS | FF_EC_DEBLOCK;
- codec_context->err_recognition = AV_EF_CAREFUL;
+ codec_context->error_recognition = FF_ER_CAREFUL;
}
// Initialize threaded decode.
@@ -349,7 +350,7 @@ int main(int argc, const char** argv) {
}
// Initialize our codec.
- if (avcodec_open2(codec_context, codec, NULL) < 0) {
+ if (avcodec_open(codec_context, codec) < 0) {
std::cerr << "Error: Could not open codec "
<< (codec_context->codec ? codec_context->codec->name : "(NULL)")
<< " for " << in_path.value() << std::endl;
@@ -532,7 +533,7 @@ int main(int argc, const char** argv) {
if (codec_context)
avcodec_close(codec_context);
if (format_context)
- avformat_close_input(&format_context);
+ av_close_input_file(format_context);
// Calculate the sum of times. Note that some of these may be zero.
double sum = 0;
diff --git a/media/webm/webm_stream_parser.cc b/media/webm/webm_stream_parser.cc
index d49ed7c..f1d6001 100644
--- a/media/webm/webm_stream_parser.cc
+++ b/media/webm/webm_stream_parser.cc
@@ -46,7 +46,7 @@ class FFmpegConfigHelper {
scoped_ptr<FFmpegURLProtocol> url_protocol_;
// FFmpeg format context for this demuxer. It is created by
- // avformat_open_input() during demuxer initialization and cleaned up with
+ // av_open_input_file() during demuxer initialization and cleaned up with
// DestroyAVFormatContext() in the destructor.
AVFormatContext* format_context_;
@@ -139,7 +139,7 @@ AVFormatContext* FFmpegConfigHelper::CreateFormatContext(const uint8* data,
// Open FFmpeg AVFormatContext.
AVFormatContext* context = NULL;
- int result = avformat_open_input(&context, key.c_str(), NULL, NULL);
+ int result = av_open_input_file(&context, key.c_str(), NULL, 0, NULL);
if (result < 0)
return NULL;
@@ -148,7 +148,7 @@ AVFormatContext* FFmpegConfigHelper::CreateFormatContext(const uint8* data,
}
bool FFmpegConfigHelper::SetupStreamConfigs() {
- int result = avformat_find_stream_info(format_context_, NULL);
+ int result = av_find_stream_info(format_context_);
if (result < 0)
return false;