OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include <deque> | 5 #include <deque> |
6 | 6 |
7 #include "base/singleton.h" | 7 #include "base/singleton.h" |
8 #include "base/tuple.h" | 8 #include "base/tuple.h" |
9 #include "media/base/filter_host.h" | 9 #include "media/base/filter_host.h" |
10 #include "media/base/filters.h" | 10 #include "media/base/filters.h" |
(...skipping 346 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
357 EXPECT_EQ(g_streams[1].duration, pipeline.GetDuration().InMicroseconds()); | 357 EXPECT_EQ(g_streams[1].duration, pipeline.GetDuration().InMicroseconds()); |
358 | 358 |
359 // Verify that 2 out of 3 streams were created. | 359 // Verify that 2 out of 3 streams were created. |
360 EXPECT_EQ(2, demuxer->GetNumberOfStreams()); | 360 EXPECT_EQ(2, demuxer->GetNumberOfStreams()); |
361 | 361 |
362 // First stream should be video and support FFmpegDemuxerStream interface. | 362 // First stream should be video and support FFmpegDemuxerStream interface. |
363 scoped_refptr<DemuxerStream> stream = demuxer->GetStream(0); | 363 scoped_refptr<DemuxerStream> stream = demuxer->GetStream(0); |
364 scoped_refptr<FFmpegDemuxerStream> ffmpeg_demuxer_stream; | 364 scoped_refptr<FFmpegDemuxerStream> ffmpeg_demuxer_stream; |
365 ASSERT_TRUE(stream); | 365 ASSERT_TRUE(stream); |
366 std::string mime_type; | 366 std::string mime_type; |
367 int result; | |
368 EXPECT_TRUE( | 367 EXPECT_TRUE( |
369 stream->media_format().GetAsString(MediaFormat::kMimeType, &mime_type)); | 368 stream->media_format().GetAsString(MediaFormat::kMimeType, &mime_type)); |
370 EXPECT_STREQ(mime_type::kFFmpegVideo, mime_type.c_str()); | 369 EXPECT_STREQ(mime_type::kFFmpegVideo, mime_type.c_str()); |
371 EXPECT_TRUE( | |
372 stream->media_format().GetAsInteger(kFFmpegCodecID, &result)); | |
373 EXPECT_EQ(CODEC_ID_THEORA, static_cast<CodecID>(result)); | |
374 EXPECT_TRUE( | |
375 stream->media_format().GetAsInteger(MediaFormat::kHeight, &result)); | |
376 EXPECT_EQ(g_video_codec.height, result); | |
377 EXPECT_TRUE( | |
378 stream->media_format().GetAsInteger(MediaFormat::kWidth, &result)); | |
379 EXPECT_EQ(g_video_codec.width, result); | |
380 EXPECT_TRUE(stream->QueryInterface(&ffmpeg_demuxer_stream)); | 370 EXPECT_TRUE(stream->QueryInterface(&ffmpeg_demuxer_stream)); |
381 EXPECT_TRUE(ffmpeg_demuxer_stream); | 371 EXPECT_TRUE(ffmpeg_demuxer_stream); |
382 EXPECT_EQ(&g_streams[1], ffmpeg_demuxer_stream->av_stream()); | 372 EXPECT_EQ(&g_streams[1], ffmpeg_demuxer_stream->av_stream()); |
383 | 373 |
384 // Second stream should be audio and support FFmpegDemuxerStream interface. | 374 // Second stream should be audio and support FFmpegDemuxerStream interface. |
385 stream = demuxer->GetStream(1); | 375 stream = demuxer->GetStream(1); |
386 ffmpeg_demuxer_stream = NULL; | 376 ffmpeg_demuxer_stream = NULL; |
387 ASSERT_TRUE(stream); | 377 ASSERT_TRUE(stream); |
388 EXPECT_TRUE( | 378 EXPECT_TRUE( |
389 stream->media_format().GetAsString(MediaFormat::kMimeType, &mime_type)); | 379 stream->media_format().GetAsString(MediaFormat::kMimeType, &mime_type)); |
390 EXPECT_STREQ(mime_type::kFFmpegAudio, mime_type.c_str()); | 380 EXPECT_STREQ(mime_type::kFFmpegAudio, mime_type.c_str()); |
391 EXPECT_TRUE( | |
392 stream->media_format().GetAsInteger(kFFmpegCodecID, &result)); | |
393 EXPECT_EQ(CODEC_ID_VORBIS, static_cast<CodecID>(result)); | |
394 EXPECT_TRUE( | |
395 stream->media_format().GetAsInteger(MediaFormat::kChannels, &result)); | |
396 EXPECT_EQ(g_audio_codec.channels, result); | |
397 EXPECT_TRUE( | |
398 stream->media_format().GetAsInteger(MediaFormat::kSampleRate, &result)); | |
399 EXPECT_EQ(g_audio_codec.sample_rate, result); | |
400 EXPECT_TRUE(stream->QueryInterface(&ffmpeg_demuxer_stream)); | 381 EXPECT_TRUE(stream->QueryInterface(&ffmpeg_demuxer_stream)); |
401 EXPECT_TRUE(ffmpeg_demuxer_stream); | 382 EXPECT_TRUE(ffmpeg_demuxer_stream); |
402 EXPECT_EQ(&g_streams[2], ffmpeg_demuxer_stream->av_stream()); | 383 EXPECT_EQ(&g_streams[2], ffmpeg_demuxer_stream->av_stream()); |
403 } | 384 } |
404 | 385 |
405 // TODO(scherkus): as we keep refactoring and improving our mocks (both FFmpeg | 386 // TODO(scherkus): as we keep refactoring and improving our mocks (both FFmpeg |
406 // and pipeline/filters), try to break this test into two. Big issue right now | 387 // and pipeline/filters), try to break this test into two. Big issue right now |
407 // is that it takes ~50 lines of code just to set up FFmpegDemuxer. | 388 // is that it takes ~50 lines of code just to set up FFmpegDemuxer. |
408 // | 389 // |
409 // TODO(scherkus): http://crbug.com/10863 | 390 // TODO(scherkus): http://crbug.com/10863 |
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
618 reader->Read(audio_stream); | 599 reader->Read(audio_stream); |
619 pipeline.RunAllTasks(); | 600 pipeline.RunAllTasks(); |
620 EXPECT_FALSE(reader->WaitForRead()); | 601 EXPECT_FALSE(reader->WaitForRead()); |
621 EXPECT_FALSE(reader->called()); | 602 EXPECT_FALSE(reader->called()); |
622 EXPECT_FALSE(reader->buffer()); | 603 EXPECT_FALSE(reader->buffer()); |
623 | 604 |
624 // Manually release buffer, which should release any remaining AVPackets. | 605 // Manually release buffer, which should release any remaining AVPackets. |
625 reader = NULL; | 606 reader = NULL; |
626 EXPECT_TRUE(PacketQueue::get()->WaitForOutstandingPackets(0)); | 607 EXPECT_TRUE(PacketQueue::get()->WaitForOutstandingPackets(0)); |
627 } | 608 } |
OLD | NEW |