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/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/cdm_promise.h" | 12 #include "media/base/cdm_promise.h" |
13 #include "media/base/decoder_buffer.h" | 13 #include "media/base/decoder_buffer.h" |
14 #include "media/base/media_keys.h" | 14 #include "media/base/media_keys.h" |
15 #include "media/base/media_switches.h" | 15 #include "media/base/media_switches.h" |
16 #include "media/base/test_data_util.h" | 16 #include "media/base/test_data_util.h" |
17 #include "media/cdm/aes_decryptor.h" | 17 #include "media/cdm/aes_decryptor.h" |
18 #include "media/cdm/json_web_key.h" | 18 #include "media/cdm/json_web_key.h" |
19 #include "media/filters/chunk_demuxer.h" | 19 #include "media/filters/chunk_demuxer.h" |
| 20 #include "media/filters/renderer_impl.h" |
20 | 21 |
21 using testing::_; | 22 using testing::_; |
22 using testing::AnyNumber; | 23 using testing::AnyNumber; |
23 using testing::AtMost; | 24 using testing::AtMost; |
24 using testing::SaveArg; | 25 using testing::SaveArg; |
25 | 26 |
26 namespace media { | 27 namespace media { |
27 | 28 |
28 const char kSourceId[] = "SourceId"; | 29 const char kSourceId[] = "SourceId"; |
29 const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; | 30 const uint8 kInitData[] = { 0x69, 0x6e, 0x69, 0x74 }; |
(...skipping 503 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
533 class PipelineIntegrationTest | 534 class PipelineIntegrationTest |
534 : public testing::Test, | 535 : public testing::Test, |
535 public PipelineIntegrationTestBase { | 536 public PipelineIntegrationTestBase { |
536 public: | 537 public: |
537 void StartPipelineWithMediaSource(MockMediaSource* source) { | 538 void StartPipelineWithMediaSource(MockMediaSource* source) { |
538 EXPECT_CALL(*this, OnMetadata(_)) | 539 EXPECT_CALL(*this, OnMetadata(_)) |
539 .Times(AtMost(1)) | 540 .Times(AtMost(1)) |
540 .WillRepeatedly(SaveArg<0>(&metadata_)); | 541 .WillRepeatedly(SaveArg<0>(&metadata_)); |
541 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) | 542 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) |
542 .Times(AtMost(1)); | 543 .Times(AtMost(1)); |
| 544 demuxer_ = source->GetDemuxer().Pass(); |
543 pipeline_->Start( | 545 pipeline_->Start( |
544 CreateFilterCollection(source->GetDemuxer(), NULL), | 546 demuxer_.get(), |
| 547 CreateRenderer(NULL), |
545 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), | 548 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), |
546 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), | 549 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), |
547 QuitOnStatusCB(PIPELINE_OK), | 550 QuitOnStatusCB(PIPELINE_OK), |
548 base::Bind(&PipelineIntegrationTest::OnMetadata, | 551 base::Bind(&PipelineIntegrationTest::OnMetadata, |
549 base::Unretained(this)), | 552 base::Unretained(this)), |
550 base::Bind(&PipelineIntegrationTest::OnBufferingStateChanged, | 553 base::Bind(&PipelineIntegrationTest::OnBufferingStateChanged, |
551 base::Unretained(this)), | 554 base::Unretained(this)), |
552 base::Closure()); | 555 base::Closure(), |
553 | 556 base::Bind(&PipelineIntegrationTest::OnAddTextTrack, |
| 557 base::Unretained(this))); |
554 message_loop_.Run(); | 558 message_loop_.Run(); |
555 } | 559 } |
556 | 560 |
557 void StartHashedPipelineWithMediaSource(MockMediaSource* source) { | 561 void StartHashedPipelineWithMediaSource(MockMediaSource* source) { |
558 hashing_enabled_ = true; | 562 hashing_enabled_ = true; |
559 StartPipelineWithMediaSource(source); | 563 StartPipelineWithMediaSource(source); |
560 } | 564 } |
561 | 565 |
562 void StartPipelineWithEncryptedMedia( | 566 void StartPipelineWithEncryptedMedia( |
563 MockMediaSource* source, | 567 MockMediaSource* source, |
564 FakeEncryptedMedia* encrypted_media) { | 568 FakeEncryptedMedia* encrypted_media) { |
565 EXPECT_CALL(*this, OnMetadata(_)) | 569 EXPECT_CALL(*this, OnMetadata(_)) |
566 .Times(AtMost(1)) | 570 .Times(AtMost(1)) |
567 .WillRepeatedly(SaveArg<0>(&metadata_)); | 571 .WillRepeatedly(SaveArg<0>(&metadata_)); |
568 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) | 572 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) |
569 .Times(AtMost(1)); | 573 .Times(AtMost(1)); |
| 574 demuxer_ = source->GetDemuxer().Pass(); |
570 pipeline_->Start( | 575 pipeline_->Start( |
571 CreateFilterCollection(source->GetDemuxer(), | 576 demuxer_.get(), |
572 encrypted_media->decryptor()), | 577 CreateRenderer(encrypted_media->decryptor()), |
573 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), | 578 base::Bind(&PipelineIntegrationTest::OnEnded, base::Unretained(this)), |
574 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), | 579 base::Bind(&PipelineIntegrationTest::OnError, base::Unretained(this)), |
575 QuitOnStatusCB(PIPELINE_OK), | 580 QuitOnStatusCB(PIPELINE_OK), |
576 base::Bind(&PipelineIntegrationTest::OnMetadata, | 581 base::Bind(&PipelineIntegrationTest::OnMetadata, |
577 base::Unretained(this)), | 582 base::Unretained(this)), |
578 base::Bind(&PipelineIntegrationTest::OnBufferingStateChanged, | 583 base::Bind(&PipelineIntegrationTest::OnBufferingStateChanged, |
579 base::Unretained(this)), | 584 base::Unretained(this)), |
580 base::Closure()); | 585 base::Closure(), |
| 586 base::Bind(&PipelineIntegrationTest::OnAddTextTrack, |
| 587 base::Unretained(this))); |
581 | 588 |
582 source->set_need_key_cb(base::Bind(&FakeEncryptedMedia::NeedKey, | 589 source->set_need_key_cb(base::Bind(&FakeEncryptedMedia::NeedKey, |
583 base::Unretained(encrypted_media))); | 590 base::Unretained(encrypted_media))); |
584 | 591 |
585 message_loop_.Run(); | 592 message_loop_.Run(); |
586 } | 593 } |
587 | 594 |
588 // Verifies that seeking works properly for ChunkDemuxer when the | 595 // Verifies that seeking works properly for ChunkDemuxer when the |
589 // seek happens while there is a pending read on the ChunkDemuxer | 596 // seek happens while there is a pending read on the ChunkDemuxer |
590 // and no data is available. | 597 // and no data is available. |
(...skipping 958 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1549 | 1556 |
1550 // Ensures audio-video playback with missing or negative timestamps fails softly | 1557 // Ensures audio-video playback with missing or negative timestamps fails softly |
1551 // instead of crashing. See http://crbug.com/396864. | 1558 // instead of crashing. See http://crbug.com/396864. |
1552 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOggVideo) { | 1559 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOggVideo) { |
1553 ASSERT_TRUE(Start(GetTestDataFilePath("double-bear.ogv"), PIPELINE_OK)); | 1560 ASSERT_TRUE(Start(GetTestDataFilePath("double-bear.ogv"), PIPELINE_OK)); |
1554 Play(); | 1561 Play(); |
1555 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); | 1562 EXPECT_EQ(PIPELINE_ERROR_DECODE, WaitUntilEndedOrError()); |
1556 } | 1563 } |
1557 | 1564 |
1558 } // namespace media | 1565 } // namespace media |
OLD | NEW |