Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(63)

Unified Diff: media/ffmpeg/ffmpeg_unittest.cc

Issue 9317096: Fix media code to work with new ffmpeg. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix deprecated methods. Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: media/ffmpeg/ffmpeg_unittest.cc
diff --git a/media/ffmpeg/ffmpeg_unittest.cc b/media/ffmpeg/ffmpeg_unittest.cc
index 9e377aaa0e1e9f6ef364af21021f171306fa40f5..983666bbfd74012c53715a9b4bca6f1028d2eb0a 100644
--- a/media/ffmpeg/ffmpeg_unittest.cc
+++ b/media/ffmpeg/ffmpeg_unittest.cc
@@ -46,6 +46,9 @@ int main(int argc, char** argv) {
namespace media {
+// Mirror setting in ffmpeg_video_decoder.
+static const int kDecodeThreads = 2;
scherkus (not reviewing) 2012/02/06 21:13:49 we should actually consider refactoring this to us
DaleCurtis 2012/02/07 19:09:13 Merge w/ PipelineIntegrationTests would probably b
+
class AVPacketQueue {
public:
AVPacketQueue() {
@@ -133,11 +136,11 @@ class FFmpegTest : public testing::TestWithParam<const char*> {
std::string ascii_path = path.value();
#endif
- EXPECT_EQ(0, av_open_input_file(&av_format_context_,
+ EXPECT_EQ(0, avformat_open_input(&av_format_context_,
ascii_path.c_str(),
scherkus (not reviewing) 2012/02/06 21:13:49 indent
DaleCurtis 2012/02/07 19:09:13 Done. Argh, cpplint.py is totally useless.
- NULL, 0, NULL))
+ NULL, NULL))
<< "Could not open " << path.value();
- EXPECT_LE(0, av_find_stream_info(av_format_context_))
+ EXPECT_LE(0, avformat_find_stream_info(av_format_context_, NULL))
<< "Could not find stream information for " << path.value();
// Determine duration by picking max stream duration.
@@ -157,7 +160,7 @@ class FFmpegTest : public testing::TestWithParam<const char*> {
}
void CloseFile() {
- av_close_input_file(av_format_context_);
+ avformat_close_input(&av_format_context_);
}
void OpenCodecs() {
@@ -169,7 +172,13 @@ class FFmpegTest : public testing::TestWithParam<const char*> {
EXPECT_TRUE(av_codec)
<< "Could not find AVCodec with CodecID "
<< av_codec_context->codec_id;
- EXPECT_EQ(0, avcodec_open(av_codec_context, av_codec))
+
+ 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))
<< "Could not open AVCodecContext with CodecID "
<< av_codec_context->codec_id;
@@ -271,7 +280,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_bits_per_sample_fmt(av_audio_context()->sample_fmt) / 8 *
+ av_get_bytes_per_sample(av_audio_context()->sample_fmt) *
av_audio_context()->sample_rate;
double microseconds = size_out /
(denominator /
@@ -402,10 +411,9 @@ 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));
+ ffurl_register_protocol(&kFFmpegFileProtocol, sizeof(kFFmpegFileProtocol));
initialized = true;
}

Powered by Google App Engine
This is Rietveld 408576698