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

Unified 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 side-by-side diff with in-line comments
Download patch
« 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 »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/test/pipeline_integration_test.cc
diff --git a/media/test/pipeline_integration_test.cc b/media/test/pipeline_integration_test.cc
index 051a758b68201eaf1dd5afe89e7262dda17f4bba..d51bb2eaddd7c0b3f4ac3bedffc422030c584055 100644
--- a/media/test/pipeline_integration_test.cc
+++ b/media/test/pipeline_integration_test.cc
@@ -685,8 +685,8 @@ class PipelineIntegrationTestHost : public service_manager::test::ServiceTest,
protected:
std::unique_ptr<Renderer> CreateRenderer(
- ScopedVector<VideoDecoder> prepend_video_decoders,
- ScopedVector<AudioDecoder> prepend_audio_decoders) override {
+ CreateVideoDecodersCB prepend_video_decoders_cb,
+ CreateAudioDecodersCB prepend_audio_decoders_cb) override {
connector()->BindInterface("media", &media_interface_factory_);
mojom::RendererPtr mojo_renderer;
@@ -1134,6 +1134,30 @@ TEST_F(PipelineIntegrationTest, PipelineStoppedWhileVideoRestartPending) {
Stop();
}
+TEST_F(PipelineIntegrationTest, SwitchAudioTrackDuringPlayback) {
+ ASSERT_EQ(PIPELINE_OK, Start("multitrack-3video-2audio.webm", kHashed));
+ Play();
+ ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(100)));
+ // The first audio track (TrackId=4) is enabled by default. This should
+ // disable TrackId=4 and enable TrackId=5.
+ std::vector<MediaTrack::Id> track_ids;
+ track_ids.push_back("5");
+ pipeline_->OnEnabledAudioTracksChanged(track_ids);
+ ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(200)));
+ Stop();
+}
+
+TEST_F(PipelineIntegrationTest, SwitchVideoTrackDuringPlayback) {
+ ASSERT_EQ(PIPELINE_OK, Start("multitrack-3video-2audio.webm", kHashed));
+ Play();
+ ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(100)));
+ // The first video track (TrackId=1) is enabled by default. This should
+ // disable TrackId=1 and enable TrackId=2.
+ pipeline_->OnSelectedVideoTrackChanged(MediaTrack::Id("2"));
+ ASSERT_TRUE(WaitUntilCurrentTimeIsAfter(TimestampMs(200)));
+ Stop();
+}
+
TEST_F(PipelineIntegrationTest,
MAYBE_CLOCKLESS(BasicPlaybackOpusOggTrimmingHashed)) {
ASSERT_EQ(PIPELINE_OK,
@@ -1658,12 +1682,15 @@ TEST_F(PipelineIntegrationTest, BasicPlaybackHi10P) {
ASSERT_TRUE(WaitUntilOnEnded());
}
-TEST_F(PipelineIntegrationTest, BasicFallback) {
+ScopedVector<VideoDecoder> CreateFailingVideoDecoder() {
ScopedVector<VideoDecoder> failing_video_decoder;
failing_video_decoder.push_back(new FailingVideoDecoder());
+ return failing_video_decoder;
+}
- ASSERT_EQ(PIPELINE_OK,
- Start("bear.mp4", kClockless, std::move(failing_video_decoder)));
+TEST_F(PipelineIntegrationTest, BasicFallback) {
+ ASSERT_EQ(PIPELINE_OK, Start("bear.mp4", kClockless,
+ base::Bind(&CreateFailingVideoDecoder)));
Play();
« 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