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

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

Issue 1716503002: Basic media tracks implementation for media stream parsers (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 9 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
« no previous file with comments | « media/media.gyp ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/memory/scoped_ptr.h" 13 #include "base/memory/scoped_ptr.h"
14 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "build/build_config.h" 16 #include "build/build_config.h"
17 #include "media/base/cdm_callback_promise.h" 17 #include "media/base/cdm_callback_promise.h"
18 #include "media/base/cdm_context.h" 18 #include "media/base/cdm_context.h"
19 #include "media/base/cdm_key_information.h" 19 #include "media/base/cdm_key_information.h"
20 #include "media/base/decoder_buffer.h" 20 #include "media/base/decoder_buffer.h"
21 #include "media/base/media.h" 21 #include "media/base/media.h"
22 #include "media/base/media_keys.h" 22 #include "media/base/media_keys.h"
23 #include "media/base/media_switches.h" 23 #include "media/base/media_switches.h"
24 #include "media/base/media_tracks.h"
24 #include "media/base/test_data_util.h" 25 #include "media/base/test_data_util.h"
25 #include "media/base/timestamp_constants.h" 26 #include "media/base/timestamp_constants.h"
26 #include "media/cdm/aes_decryptor.h" 27 #include "media/cdm/aes_decryptor.h"
27 #include "media/cdm/json_web_key.h" 28 #include "media/cdm/json_web_key.h"
28 #include "media/filters/chunk_demuxer.h" 29 #include "media/filters/chunk_demuxer.h"
29 #include "media/renderers/renderer_impl.h" 30 #include "media/renderers/renderer_impl.h"
30 #include "media/test/pipeline_integration_test_base.h" 31 #include "media/test/pipeline_integration_test_base.h"
31 #include "testing/gmock/include/gmock/gmock.h" 32 #include "testing/gmock/include/gmock/gmock.h"
32 #include "url/gurl.h" 33 #include "url/gurl.h"
33 34
(...skipping 595 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 const std::vector<uint8_t>& init_data) { 630 const std::vector<uint8_t>& init_data) {
630 DCHECK(!init_data.empty()); 631 DCHECK(!init_data.empty());
631 CHECK(!encrypted_media_init_data_cb_.is_null()); 632 CHECK(!encrypted_media_init_data_cb_.is_null());
632 encrypted_media_init_data_cb_.Run(init_data_type, init_data); 633 encrypted_media_init_data_cb_.Run(init_data_type, init_data);
633 } 634 }
634 635
635 base::TimeDelta last_timestamp_offset() const { 636 base::TimeDelta last_timestamp_offset() const {
636 return last_timestamp_offset_; 637 return last_timestamp_offset_;
637 } 638 }
638 639
639 MOCK_METHOD0(InitSegmentReceived, void(void)); 640 MOCK_METHOD1(InitSegmentReceived, void(const MediaTracks&));
640 641
641 private: 642 private:
642 scoped_refptr<DecoderBuffer> file_data_; 643 scoped_refptr<DecoderBuffer> file_data_;
643 size_t current_position_; 644 size_t current_position_;
644 size_t initial_append_size_; 645 size_t initial_append_size_;
645 std::string mimetype_; 646 std::string mimetype_;
646 ChunkDemuxer* chunk_demuxer_; 647 ChunkDemuxer* chunk_demuxer_;
647 scoped_ptr<Demuxer> owned_chunk_demuxer_; 648 scoped_ptr<Demuxer> owned_chunk_demuxer_;
648 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_; 649 Demuxer::EncryptedMediaInitDataCB encrypted_media_init_data_cb_;
649 base::TimeDelta last_timestamp_offset_; 650 base::TimeDelta last_timestamp_offset_;
(...skipping 25 matching lines...) Expand all
675 interfaces::ServiceFactoryPtr media_service_factory_; 676 interfaces::ServiceFactoryPtr media_service_factory_;
676 }; 677 };
677 #else 678 #else
678 class PipelineIntegrationTestHost : public testing::Test, 679 class PipelineIntegrationTestHost : public testing::Test,
679 public PipelineIntegrationTestBase {}; 680 public PipelineIntegrationTestBase {};
680 #endif // defined(MOJO_RENDERER) 681 #endif // defined(MOJO_RENDERER)
681 682
682 class PipelineIntegrationTest : public PipelineIntegrationTestHost { 683 class PipelineIntegrationTest : public PipelineIntegrationTestHost {
683 public: 684 public:
684 void StartPipelineWithMediaSource(MockMediaSource* source) { 685 void StartPipelineWithMediaSource(MockMediaSource* source) {
685 EXPECT_CALL(*source, InitSegmentReceived()).Times(AtLeast(1)); 686 EXPECT_CALL(*source, InitSegmentReceived(_)).Times(AtLeast(1));
686 EXPECT_CALL(*this, OnMetadata(_)) 687 EXPECT_CALL(*this, OnMetadata(_))
687 .Times(AtMost(1)) 688 .Times(AtMost(1))
688 .WillRepeatedly(SaveArg<0>(&metadata_)); 689 .WillRepeatedly(SaveArg<0>(&metadata_));
689 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) 690 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH))
690 .Times(AnyNumber()); 691 .Times(AnyNumber());
691 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_NOTHING)) 692 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_NOTHING))
692 .Times(AnyNumber()); 693 .Times(AnyNumber());
693 694
694 // Encrypted content not used, so this is never called. 695 // Encrypted content not used, so this is never called.
695 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0); 696 EXPECT_CALL(*this, OnWaitingForDecryptionKey()).Times(0);
(...skipping 23 matching lines...) Expand all
719 } 720 }
720 721
721 void StartHashedClocklessPipelineWithMediaSource(MockMediaSource* source) { 722 void StartHashedClocklessPipelineWithMediaSource(MockMediaSource* source) {
722 hashing_enabled_ = true; 723 hashing_enabled_ = true;
723 clockless_playback_ = true; 724 clockless_playback_ = true;
724 StartPipelineWithMediaSource(source); 725 StartPipelineWithMediaSource(source);
725 } 726 }
726 727
727 void StartPipelineWithEncryptedMedia(MockMediaSource* source, 728 void StartPipelineWithEncryptedMedia(MockMediaSource* source,
728 FakeEncryptedMedia* encrypted_media) { 729 FakeEncryptedMedia* encrypted_media) {
729 EXPECT_CALL(*source, InitSegmentReceived()).Times(AtLeast(1)); 730 EXPECT_CALL(*source, InitSegmentReceived(_)).Times(AtLeast(1));
730 EXPECT_CALL(*this, OnMetadata(_)) 731 EXPECT_CALL(*this, OnMetadata(_))
731 .Times(AtMost(1)) 732 .Times(AtMost(1))
732 .WillRepeatedly(SaveArg<0>(&metadata_)); 733 .WillRepeatedly(SaveArg<0>(&metadata_));
733 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH)) 734 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH))
734 .Times(AnyNumber()); 735 .Times(AnyNumber());
735 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_NOTHING)) 736 EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_NOTHING))
736 .Times(AnyNumber()); 737 .Times(AnyNumber());
737 EXPECT_CALL(*this, DecryptorAttached(true)); 738 EXPECT_CALL(*this, DecryptorAttached(true));
738 739
739 // Encrypted content used but keys provided in advance, so this is 740 // Encrypted content used but keys provided in advance, so this is
(...skipping 1280 matching lines...) Expand 10 before | Expand all | Expand 10 after
2020 2021
2021 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2022 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2022 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2023 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2023 Play(); 2024 Play();
2024 ASSERT_TRUE(WaitUntilOnEnded()); 2025 ASSERT_TRUE(WaitUntilOnEnded());
2025 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2026 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2026 demuxer_->GetStartTime()); 2027 demuxer_->GetStartTime());
2027 } 2028 }
2028 2029
2029 } // namespace media 2030 } // namespace media
OLDNEW
« no previous file with comments | « media/media.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698