Skip to content

Commit

Permalink
Revert 123123 (probably caused a big perf regression -- http://crbug.…
Browse files Browse the repository at this point in the history
…com/115479,

and possibly made frame rate tests fail: http://crbug.com/115477. Will revert
the revert if it doesn't help.) - Fix media code to work with new ffmpeg.

Once ffmpeg git, svn are updated to new ffmpeg, will update DEPS
in this CL.  Which when committed, should seal the deal for the
ffmpeg roll.

API Changes:
avutil: SampleFormat->AVSampleFormat
avutil: av_get_bits_per_sample_fmt -> av_get_bytes_per_sample
avcodec: avcodec_open -> avcodec_open2(..., NULL)
avcodec: avcodec_decode_video2(... AVPacket ...) -> const AVPacket.
avformat: av_open_input_file -> avformat_open_input
avformat: av_register_protocol2 -> ffurl_register_protocol
avformat: av_close_input_file -> avformat_close_input(&...)
avformat: av_find_stream_info -> avformat_find_stream_info(..., NULL)

URLContext now has a url_open2 method as well, for now I've set this
to NULL.

Also fixes:
- ffmpeg_unittests change threading to mirror ffmpeg_video_decoder. There's
an issue where threading causes the last frames of a no-audio video to be
clipped. It existed before this ffmpeg roll, but because threading was
disabled by default in ffmpeg, we never noticed it.

- ffmpeg_demuxer_tests: GetBitrate_UnsetInContainer_NoFileSize now passes.

- New ffmpeg_unittests passes:
sync0_ogv/FFmpegTest.Seek_Video/0, where GetParam() = "sync0.ogv"
sync1_ogv/FFmpegTest.Seek_Video/0, where GetParam() = "sync1.ogv"
sync2_ogv/FFmpegTest.Seek_Video/0, where GetParam() = "sync2.ogv"

FFmpeg fixups here, https://chromiumcodereview.appspot.com/9325049/
New git repo here: http://git.chromium.org/gitweb/?p=chromium/third_party/ffmpeg.git;a=summary
Merge+Patches diff: https://chromiumcodereview.appspot.com/9317107

BUG=110776
TEST=unittests, layouttests, etc. Trybots.

Review URL: https://chromiumcodereview.appspot.com/9317096

TBR=dalecurtis@google.com
Review URL: https://chromiumcodereview.appspot.com/9455018

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@123249 0039d316-1c4b-4281-b951-d872f2087c98
  • Loading branch information
thakis@chromium.org committed Feb 23, 2012
1 parent e9f0ce3 commit 53d688f
Show file tree
Hide file tree
Showing 24 changed files with 126 additions and 156 deletions.
12 changes: 5 additions & 7 deletions DEPS
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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":
Expand Down Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions chrome/app/chrome.dll.deps
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand Down
4 changes: 2 additions & 2 deletions chrome/tools/build/win/FILES.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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'],
},
Expand Down
4 changes: 2 additions & 2 deletions chrome_frame/test/perf/chrome_frame_perftest.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down
3 changes: 0 additions & 3 deletions media/base/audio_decoder_config.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions media/base/media_posix.cc
Original file line number Diff line number Diff line change
@@ -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.

Expand Down Expand Up @@ -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));
Expand Down
6 changes: 3 additions & 3 deletions media/base/media_win.cc
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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:
Expand Down
38 changes: 19 additions & 19 deletions media/ffmpeg/ffmpeg_common.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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;
Expand 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
1 change: 0 additions & 1 deletion media/ffmpeg/ffmpeg_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
49 changes: 17 additions & 32 deletions media/ffmpeg/ffmpeg_regression_tests.cc
Original file line number Diff line number Diff line change
@@ -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"

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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",
Expand All @@ -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);
Expand All @@ -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
Expand Down
Loading

0 comments on commit 53d688f

Please sign in to comment.