OLD | NEW |
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/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/string_util.h" | 9 #include "base/string_util.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
306 Tokenize(codecStr, ",", &codecs); | 306 Tokenize(codecStr, ",", &codecs); |
307 | 307 |
308 CHECK_EQ(chunk_demuxer_->AddId(kSourceId, type, codecs), ChunkDemuxer::kOk); | 308 CHECK_EQ(chunk_demuxer_->AddId(kSourceId, type, codecs), ChunkDemuxer::kOk); |
309 AppendData(initial_append_size_); | 309 AppendData(initial_append_size_); |
310 } | 310 } |
311 | 311 |
312 void DemuxerNeedKey(const std::string& type, | 312 void DemuxerNeedKey(const std::string& type, |
313 scoped_array<uint8> init_data, int init_data_size) { | 313 scoped_array<uint8> init_data, int init_data_size) { |
314 DCHECK(init_data.get()); | 314 DCHECK(init_data.get()); |
315 DCHECK_GT(init_data_size, 0); | 315 DCHECK_GT(init_data_size, 0); |
| 316 CHECK(!need_key_cb_.is_null()); |
316 need_key_cb_.Run("", "", type, init_data.Pass(), init_data_size); | 317 need_key_cb_.Run("", "", type, init_data.Pass(), init_data_size); |
317 } | 318 } |
318 | 319 |
319 private: | 320 private: |
320 base::FilePath file_path_; | 321 base::FilePath file_path_; |
321 scoped_refptr<DecoderBuffer> file_data_; | 322 scoped_refptr<DecoderBuffer> file_data_; |
322 int current_position_; | 323 int current_position_; |
323 int initial_append_size_; | 324 int initial_append_size_; |
324 std::string mimetype_; | 325 std::string mimetype_; |
325 scoped_refptr<ChunkDemuxer> chunk_demuxer_; | 326 scoped_refptr<ChunkDemuxer> chunk_demuxer_; |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
417 | 418 |
418 ASSERT_TRUE(WaitUntilOnEnded()); | 419 ASSERT_TRUE(WaitUntilOnEnded()); |
419 | 420 |
420 EXPECT_EQ(GetVideoHash(), "f0be120a90a811506777c99a2cdf7cc1"); | 421 EXPECT_EQ(GetVideoHash(), "f0be120a90a811506777c99a2cdf7cc1"); |
421 | 422 |
422 // TODO(dalecurtis): Audio decoded in float does not have a consistent hash | 423 // TODO(dalecurtis): Audio decoded in float does not have a consistent hash |
423 // across platforms. Fix this: http://crbug.com/168204 | 424 // across platforms. Fix this: http://crbug.com/168204 |
424 // EXPECT_EQ(GetAudioHash(), ""); | 425 // EXPECT_EQ(GetAudioHash(), ""); |
425 } | 426 } |
426 | 427 |
| 428 // TODO(fgalligan): Enable test when code to parse encrypted WebM files lands |
| 429 // in Chromium's FFmpeg. crbug.com/189221 |
| 430 TEST_F(PipelineIntegrationTest, DISABLED_BasicPlaybackEncrypted) { |
| 431 FakeEncryptedMedia encrypted_media(new KeyProvidingApp()); |
| 432 set_need_key_cb(base::Bind(&FakeEncryptedMedia::NeedKey, |
| 433 base::Unretained(&encrypted_media))); |
| 434 |
| 435 ASSERT_TRUE(Start(GetTestDataFilePath("bear-320x240-av_enc-av.webm"), |
| 436 encrypted_media.decryptor())); |
| 437 |
| 438 Play(); |
| 439 |
| 440 ASSERT_TRUE(WaitUntilOnEnded()); |
| 441 Stop(); |
| 442 } |
| 443 |
427 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource) { | 444 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource) { |
428 MockMediaSource source("bear-320x240.webm", kWebM, 219229); | 445 MockMediaSource source("bear-320x240.webm", kWebM, 219229); |
429 StartPipelineWithMediaSource(&source); | 446 StartPipelineWithMediaSource(&source); |
430 source.EndOfStream(); | 447 source.EndOfStream(); |
431 | 448 |
432 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); | 449 EXPECT_EQ(1u, pipeline_->GetBufferedTimeRanges().size()); |
433 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); | 450 EXPECT_EQ(0, pipeline_->GetBufferedTimeRanges().start(0).InMilliseconds()); |
434 EXPECT_EQ(k320WebMFileDurationMs, | 451 EXPECT_EQ(k320WebMFileDurationMs, |
435 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); | 452 pipeline_->GetBufferedTimeRanges().end(0).InMilliseconds()); |
436 | 453 |
(...skipping 441 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
878 // back. | 895 // back. |
879 // Disabled since it might crash or corrupt heap, see http://crbug.com/173333 | 896 // Disabled since it might crash or corrupt heap, see http://crbug.com/173333 |
880 TEST_F(PipelineIntegrationTest, DISABLED_BasicPlayback_VP9_Opus_WebM) { | 897 TEST_F(PipelineIntegrationTest, DISABLED_BasicPlayback_VP9_Opus_WebM) { |
881 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp9-opus.webm"), | 898 ASSERT_TRUE(Start(GetTestDataFilePath("bear-vp9-opus.webm"), |
882 PIPELINE_OK)); | 899 PIPELINE_OK)); |
883 Play(); | 900 Play(); |
884 ASSERT_TRUE(WaitUntilOnEnded()); | 901 ASSERT_TRUE(WaitUntilOnEnded()); |
885 } | 902 } |
886 | 903 |
887 } // namespace media | 904 } // namespace media |
OLD | NEW |