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

Side by Side Diff: media/filters/pipeline_integration_test.cc

Issue 23014009: media: Opus support for WebM in Media Source (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase and addressing comments Created 7 years, 3 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "media/filters/pipeline_integration_test_base.h" 5 #include "media/filters/pipeline_integration_test_base.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/memory/scoped_ptr.h" 9 #include "base/memory/scoped_ptr.h"
10 #include "base/strings/string_util.h" 10 #include "base/strings/string_util.h"
11 #include "build/build_config.h" 11 #include "build/build_config.h"
12 #include "media/base/decoder_buffer.h" 12 #include "media/base/decoder_buffer.h"
13 #include "media/base/media_keys.h" 13 #include "media/base/media_keys.h"
14 #include "media/base/test_data_util.h" 14 #include "media/base/test_data_util.h"
15 #include "media/cdm/aes_decryptor.h" 15 #include "media/cdm/aes_decryptor.h"
16 #include "media/filters/chunk_demuxer.h" 16 #include "media/filters/chunk_demuxer.h"
17 17
18 using testing::AnyNumber; 18 using testing::AnyNumber;
19 using testing::AtMost; 19 using testing::AtMost;
20 20
21 namespace media { 21 namespace media {
22 22
23 static const char kSourceId[] = "SourceId"; 23 static const char kSourceId[] = "SourceId";
24 static const char kClearKeySystem[] = "org.w3.clearkey"; 24 static const char kClearKeySystem[] = "org.w3.clearkey";
25 static const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; 25 static const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 };
26 26
27 static const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\""; 27 static const char kWebM[] = "video/webm; codecs=\"vp8,vorbis\"";
28 static const char kWebMVP9[] = "video/webm; codecs=\"vp9\""; 28 static const char kWebMVP9[] = "video/webm; codecs=\"vp9\"";
29 static const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\""; 29 static const char kAudioOnlyWebM[] = "video/webm; codecs=\"vorbis\"";
30 static const char kOpusAudioOnlyWebM[] = "video/webm; codecs=\"opus\"";
30 static const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\""; 31 static const char kVideoOnlyWebM[] = "video/webm; codecs=\"vp8\"";
31 static const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\""; 32 static const char kMP4[] = "video/mp4; codecs=\"avc1.4D4041,mp4a.40.2\"";
32 static const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\""; 33 static const char kMP4Video[] = "video/mp4; codecs=\"avc1.4D4041\"";
33 static const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\""; 34 static const char kMP4Audio[] = "audio/mp4; codecs=\"mp4a.40.2\"";
34 static const char kMP4AudioType[] = "audio/mp4"; 35 static const char kMP4AudioType[] = "audio/mp4";
35 static const char kMP4VideoType[] = "video/mp4"; 36 static const char kMP4VideoType[] = "video/mp4";
36 37
37 // Key used to encrypt test files. 38 // Key used to encrypt test files.
38 static const uint8 kSecretKey[] = { 39 static const uint8 kSecretKey[] = {
39 0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b, 40 0xeb, 0xdd, 0x62, 0xf1, 0x68, 0x14, 0xd2, 0x7b,
40 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c 41 0x68, 0xef, 0x12, 0x2a, 0xfc, 0xe4, 0xae, 0x3c
41 }; 42 };
42 43
43 // The key ID for all encrypted files. 44 // The key ID for all encrypted files.
44 static const uint8 kKeyId[] = { 45 static const uint8 kKeyId[] = {
45 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 46 0x30, 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37,
46 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35 47 0x38, 0x39, 0x30, 0x31, 0x32, 0x33, 0x34, 0x35
47 }; 48 };
48 49
49 static const int kAppendWholeFile = -1; 50 static const int kAppendWholeFile = -1;
50 51
51 // Constants for the Media Source config change tests. 52 // Constants for the Media Source config change tests.
52 static const int kAppendTimeSec = 1; 53 static const int kAppendTimeSec = 1;
53 static const int kAppendTimeMs = kAppendTimeSec * 1000; 54 static const int kAppendTimeMs = kAppendTimeSec * 1000;
54 static const int k320WebMFileDurationMs = 2737; 55 static const int k320WebMFileDurationMs = 2737;
55 static const int k640WebMFileDurationMs = 2763; 56 static const int k640WebMFileDurationMs = 2763;
56 static const int k640IsoFileDurationMs = 2737; 57 static const int k640IsoFileDurationMs = 2737;
57 static const int k640IsoCencFileDurationMs = 2736; 58 static const int k640IsoCencFileDurationMs = 2736;
58 static const int k1280IsoFileDurationMs = 2736; 59 static const int k1280IsoFileDurationMs = 2736;
60 static const int kOpusEndTrimmingWebMFileDurationMs = 2771;
61 static const uint32 kOpusEndTrimmingWebMFileAudioBytes = 528676;
59 static const int kVP9WebMFileDurationMs = 2735; 62 static const int kVP9WebMFileDurationMs = 2735;
60 static const int kVP8AWebMFileDurationMs = 2700; 63 static const int kVP8AWebMFileDurationMs = 2700;
61 64
62 // Command line switch for runtime adjustment of audio file to be benchmarked. 65 // Command line switch for runtime adjustment of audio file to be benchmarked.
63 static const char kBenchmarkAudioFile[] = "benchmark-audio-file"; 66 static const char kBenchmarkAudioFile[] = "benchmark-audio-file";
64 67
65 // Note: Tests using this class only exercise the DecryptingDemuxerStream path. 68 // Note: Tests using this class only exercise the DecryptingDemuxerStream path.
66 // They do not exercise the Decrypting{Audio|Video}Decoder path. 69 // They do not exercise the Decrypting{Audio|Video}Decoder path.
67 class FakeEncryptedMedia { 70 class FakeEncryptedMedia {
68 public: 71 public:
(...skipping 440 matching lines...) Expand 10 before | Expand all | Expand 10 after
509 EXPECT_EQ(kVP8AWebMFileDurationMs, 512 EXPECT_EQ(kVP8AWebMFileDurationMs,
510 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); 513 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
511 514
512 Play(); 515 Play();
513 516
514 ASSERT_TRUE(WaitUntilOnEnded()); 517 ASSERT_TRUE(WaitUntilOnEnded());
515 source.Abort(); 518 source.Abort();
516 Stop(); 519 Stop();
517 } 520 }
518 521
522 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus_WebM) {
523 EXPECT_CALL(*this, OnSetOpaque(false)).Times(AnyNumber());
524 MockMediaSource source("bear-opus-end-trimming.webm", kOpusAudioOnlyWebM,
525 kAppendWholeFile);
526 StartPipelineWithMediaSource(&source);
527 source.EndOfStream();
528
529 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size());
530 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds());
531 EXPECT_EQ(kOpusEndTrimmingWebMFileDurationMs,
532 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds());
533 Play();
534
535 ASSERT_TRUE(WaitUntilOnEnded());
536 EXPECT_EQ(kOpusEndTrimmingWebMFileAudioBytes,
537 pipeline_->GetStatistics().audio_bytes_decoded);
538 source.Abort();
539 Stop();
540 }
541
519 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) { 542 TEST_F(PipelineIntegrationTest, MediaSource_ConfigChange_WebM) {
520 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM, 543 MockMediaSource source("bear-320x240-16x9-aspect.webm", kWebM,
521 kAppendWholeFile); 544 kAppendWholeFile);
522 StartPipelineWithMediaSource(&source); 545 StartPipelineWithMediaSource(&source);
523 546
524 scoped_refptr<DecoderBuffer> second_file = 547 scoped_refptr<DecoderBuffer> second_file =
525 ReadTestDataFile("bear-640x360.webm"); 548 ReadTestDataFile("bear-640x360.webm");
526 549
527 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec), 550 source.AppendAtTime(base::TimeDelta::FromSeconds(kAppendTimeSec),
528 second_file->data(), second_file->data_size()); 551 second_file->data(), second_file->data_size());
(...skipping 397 matching lines...) Expand 10 before | Expand all | Expand 10 after
926 // Verify video decoder & renderer can handle aborted demuxer reads. 949 // Verify video decoder & renderer can handle aborted demuxer reads.
927 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) { 950 TEST_F(PipelineIntegrationTest, ChunkDemuxerAbortRead_VideoOnly) {
928 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM, 951 ASSERT_TRUE(TestSeekDuringRead("bear-320x240-video-only.webm", kVideoOnlyWebM,
929 32768, 952 32768,
930 base::TimeDelta::FromMilliseconds(200), 953 base::TimeDelta::FromMilliseconds(200),
931 base::TimeDelta::FromMilliseconds(1668), 954 base::TimeDelta::FromMilliseconds(1668),
932 0x1C896, 65536)); 955 0x1C896, 65536));
933 } 956 }
934 957
935 // Verify that Opus audio in WebM containers can be played back. 958 // Verify that Opus audio in WebM containers can be played back.
936 TEST_F(PipelineIntegrationTest, BasicPlayback_AudioOnly_Opus_WebM) { 959 TEST_F(PipelineIntegrationTest, DISABLED_BasicPlayback_AudioOnly_Opus_WebM) {
acolwell GONE FROM CHROMIUM 2013/09/04 20:08:43 nit: Please reinstate the necessary code in opus_a
vignesh 2013/09/04 20:27:46 Done.
937 ASSERT_TRUE(Start(GetTestDataFilePath("bear-opus.webm"), 960 ASSERT_TRUE(Start(GetTestDataFilePath("bear-opus.webm"),
938 PIPELINE_OK)); 961 PIPELINE_OK));
939 Play(); 962 Play();
940 ASSERT_TRUE(WaitUntilOnEnded()); 963 ASSERT_TRUE(WaitUntilOnEnded());
941 } 964 }
942 965
943 // Verify that VP9 video in WebM containers can be played back. 966 // Verify that VP9 video in WebM containers can be played back.
944 // TODO(fgalligan): Enable after new vp9 files are landed. 967 // TODO(fgalligan): Enable after new vp9 files are landed.
945 // http://crbug.com/259116 968 // http://crbug.com/259116
946 TEST_F(PipelineIntegrationTest, DISABLED_BasicPlayback_VideoOnly_VP9_WebM) { 969 TEST_F(PipelineIntegrationTest, DISABLED_BasicPlayback_VideoOnly_VP9_WebM) {
(...skipping 26 matching lines...) Expand all
973 996
974 // Verify that VP8 video with inband text track can be played back. 997 // Verify that VP8 video with inband text track can be played back.
975 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8_WebVTT_WebM) { 998 TEST_F(PipelineIntegrationTest, BasicPlayback_VP8_WebVTT_WebM) {
976 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"), 999 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp8-webvtt.webm"),
977 PIPELINE_OK)); 1000 PIPELINE_OK));
978 Play(); 1001 Play();
979 ASSERT_TRUE(WaitUntilOnEnded()); 1002 ASSERT_TRUE(WaitUntilOnEnded());
980 } 1003 }
981 1004
982 } // namespace media 1005 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698