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

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

Issue 2684103005: Allow media track switching. (Closed)
Patch Set: Fixed comments Created 3 years, 8 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 667 matching lines...) Expand 10 before | Expand all | Expand 10 after
678 : service_manager::test::ServiceTest( 678 : service_manager::test::ServiceTest(
679 "media_pipeline_integration_shelltests") {} 679 "media_pipeline_integration_shelltests") {}
680 680
681 void SetUp() override { 681 void SetUp() override {
682 ServiceTest::SetUp(); 682 ServiceTest::SetUp();
683 InitializeMediaLibrary(); 683 InitializeMediaLibrary();
684 } 684 }
685 685
686 protected: 686 protected:
687 std::unique_ptr<Renderer> CreateRenderer( 687 std::unique_ptr<Renderer> CreateRenderer(
688 ScopedVector<VideoDecoder> prepend_video_decoders, 688 CreateVideoDecodersCB prepend_video_decoders_cb,
689 ScopedVector<AudioDecoder> prepend_audio_decoders) override { 689 CreateAudioDecodersCB prepend_audio_decoders_cb) override {
690 connector()->BindInterface("media", &media_interface_factory_); 690 connector()->BindInterface("media", &media_interface_factory_);
691 691
692 mojom::RendererPtr mojo_renderer; 692 mojom::RendererPtr mojo_renderer;
693 media_interface_factory_->CreateRenderer(std::string(), 693 media_interface_factory_->CreateRenderer(std::string(),
694 mojo::MakeRequest(&mojo_renderer)); 694 mojo::MakeRequest(&mojo_renderer));
695 695
696 return base::MakeUnique<MojoRenderer>(message_loop_.task_runner(), 696 return base::MakeUnique<MojoRenderer>(message_loop_.task_runner(),
697 std::move(mojo_renderer)); 697 std::move(mojo_renderer));
698 } 698 }
699 699
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
1127 1127
1128 // Disable video track first, to re-enable it later and stop the pipeline 1128 // Disable video track first, to re-enable it later and stop the pipeline
1129 // (which destroys the media renderer) while video restart is pending. 1129 // (which destroys the media renderer) while video restart is pending.
1130 pipeline_->OnSelectedVideoTrackChanged(base::nullopt); 1130 pipeline_->OnSelectedVideoTrackChanged(base::nullopt);
1131 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(200))); 1131 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(200)));
1132 1132
1133 pipeline_->OnSelectedVideoTrackChanged(MediaTrack::Id("1")); 1133 pipeline_->OnSelectedVideoTrackChanged(MediaTrack::Id("1"));
1134 Stop(); 1134 Stop();
1135 } 1135 }
1136 1136
1137 TEST_F(PipelineIntegrationTest, SwitchAudioTrackDuringPlayback) {
1138 ASSERT_EQ(PIPELINE_OK, Start("multitrack-3video-2audio.webm", kHashed));
1139 Play();
1140 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(100)));
1141 // The first audio track (TrackId=4) is enabled by default. This should
1142 // disable TrackId=4 and enable TrackId=5.
1143 std::vector<MediaTrack::Id> track_ids;
1144 track_ids.push_back("5");
1145 pipeline_->OnEnabledAudioTracksChanged(track_ids);
1146 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(200)));
1147 Stop();
1148 }
1149
1150 TEST_F(PipelineIntegrationTest, SwitchVideoTrackDuringPlayback) {
1151 ASSERT_EQ(PIPELINE_OK, Start("multitrack-3video-2audio.webm", kHashed));
1152 Play();
1153 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(100)));
1154 // The first video track (TrackId=1) is enabled by default. This should
1155 // disable TrackId=1 and enable TrackId=2.
1156 pipeline_->OnSelectedVideoTrackChanged(MediaTrack::Id("2"));
1157 ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(200)));
1158 Stop();
1159 }
1160
1137 TEST_F(PipelineIntegrationTest, 1161 TEST_F(PipelineIntegrationTest,
1138 MAYBE_CLOCKLESS(BasicPlaybackOpusOggTrimmingHashed)) { 1162 MAYBE_CLOCKLESS(BasicPlaybackOpusOggTrimmingHashed)) {
1139 ASSERT_EQ(PIPELINE_OK, 1163 ASSERT_EQ(PIPELINE_OK,
1140 Start("opus-trimming-test.webm", kHashed | kClockless)); 1164 Start("opus-trimming-test.webm", kHashed | kClockless));
1141 1165
1142 Play(); 1166 Play();
1143 1167
1144 ASSERT_TRUE(WaitUntilOnEnded()); 1168 ASSERT_TRUE(WaitUntilOnEnded());
1145 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash()); 1169 EXPECT_HASH_EQ(kOpusEndTrimmingHash_1, GetAudioHash());
1146 1170
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
1651 #if BUILDFLAG(USE_PROPRIETARY_CODECS) 1675 #if BUILDFLAG(USE_PROPRIETARY_CODECS)
1652 1676
1653 TEST_F(PipelineIntegrationTest, BasicPlaybackHi10P) { 1677 TEST_F(PipelineIntegrationTest, BasicPlaybackHi10P) {
1654 ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi10p.mp4", kClockless)); 1678 ASSERT_EQ(PIPELINE_OK, Start("bear-320x180-hi10p.mp4", kClockless));
1655 1679
1656 Play(); 1680 Play();
1657 1681
1658 ASSERT_TRUE(WaitUntilOnEnded()); 1682 ASSERT_TRUE(WaitUntilOnEnded());
1659 } 1683 }
1660 1684
1661 TEST_F(PipelineIntegrationTest, BasicFallback) { 1685 ScopedVector<VideoDecoder> CreateFailingVideoDecoder() {
1662 ScopedVector<VideoDecoder> failing_video_decoder; 1686 ScopedVector<VideoDecoder> failing_video_decoder;
1663 failing_video_decoder.push_back(new FailingVideoDecoder()); 1687 failing_video_decoder.push_back(new FailingVideoDecoder());
1688 return failing_video_decoder;
1689 }
1664 1690
1665 ASSERT_EQ(PIPELINE_OK, 1691 TEST_F(PipelineIntegrationTest, BasicFallback) {
1666 Start("bear.mp4", kClockless, std::move(failing_video_decoder))); 1692 ASSERT_EQ(PIPELINE_OK, Start("bear.mp4", kClockless,
1693 base::Bind(&CreateFailingVideoDecoder)));
1667 1694
1668 Play(); 1695 Play();
1669 1696
1670 ASSERT_TRUE(WaitUntilOnEnded()); 1697 ASSERT_TRUE(WaitUntilOnEnded());
1671 }; 1698 };
1672 1699
1673 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) { 1700 TEST_F(PipelineIntegrationTest, MediaSource_ADTS) {
1674 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile); 1701 MockMediaSource source("sfx.adts", kADTS, kAppendWholeFile);
1675 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 1702 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
1676 source.EndOfStream(); 1703 source.EndOfStream();
(...skipping 967 matching lines...) Expand 10 before | Expand all | Expand 10 after
2644 2671
2645 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2672 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2646 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2673 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2647 Play(); 2674 Play();
2648 ASSERT_TRUE(WaitUntilOnEnded()); 2675 ASSERT_TRUE(WaitUntilOnEnded());
2649 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2676 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2650 demuxer_->GetStartTime()); 2677 demuxer_->GetStartTime());
2651 } 2678 }
2652 2679
2653 } // namespace media 2680 } // namespace media
OLDNEW
« no previous file with comments | « media/renderers/video_renderer_impl_unittest.cc ('k') | media/test/pipeline_integration_test_base.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698