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

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

Issue 2491043003: MediaResource refactoring to support multiple streams (Closed)
Patch Set: Added a TODO about DemuxerStream enabled/set_enabled methods Created 3 years, 10 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/renderers/renderer_impl_unittest.cc ('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 7
8 #include <memory> 8 #include <memory>
9 #include <utility> 9 #include <utility>
10 10
(...skipping 1163 matching lines...) Expand 10 before | Expand all | Expand 10 after
1174 Play(); 1174 Play();
1175 ASSERT_TRUE(WaitUntilOnEnded()); 1175 ASSERT_TRUE(WaitUntilOnEnded());
1176 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash()); 1176 EXPECT_HASH_EQ(kOpusEndTrimmingHash_3, GetAudioHash());
1177 } 1177 }
1178 1178
1179 TEST_F(PipelineIntegrationTest, 1179 TEST_F(PipelineIntegrationTest,
1180 MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay)) { 1180 MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay)) {
1181 ASSERT_EQ(PIPELINE_OK, Start("bear-opus.webm", kHashed | kClockless)); 1181 ASSERT_EQ(PIPELINE_OK, Start("bear-opus.webm", kHashed | kClockless));
1182 1182
1183 AudioDecoderConfig config = 1183 AudioDecoderConfig config =
1184 demuxer_->GetStream(DemuxerStream::AUDIO)->audio_decoder_config(); 1184 demuxer_->GetFirstStream(DemuxerStream::AUDIO)->audio_decoder_config();
1185 1185
1186 // Verify that this file's preroll is not eclipsed by the codec delay so we 1186 // Verify that this file's preroll is not eclipsed by the codec delay so we
1187 // can detect when preroll is not properly performed. 1187 // can detect when preroll is not properly performed.
1188 base::TimeDelta codec_delay = base::TimeDelta::FromSecondsD( 1188 base::TimeDelta codec_delay = base::TimeDelta::FromSecondsD(
1189 static_cast<double>(config.codec_delay()) / config.samples_per_second()); 1189 static_cast<double>(config.codec_delay()) / config.samples_per_second());
1190 ASSERT_GT(config.seek_preroll(), codec_delay); 1190 ASSERT_GT(config.seek_preroll(), codec_delay);
1191 1191
1192 Play(); 1192 Play();
1193 ASSERT_TRUE(WaitUntilOnEnded()); 1193 ASSERT_TRUE(WaitUntilOnEnded());
1194 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash()); 1194 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash());
1195 1195
1196 // Seek halfway through the file to invoke seek preroll. 1196 // Seek halfway through the file to invoke seek preroll.
1197 ASSERT_TRUE(Seek(base::TimeDelta::FromSecondsD(1.414))); 1197 ASSERT_TRUE(Seek(base::TimeDelta::FromSecondsD(1.414)));
1198 Play(); 1198 Play();
1199 ASSERT_TRUE(WaitUntilOnEnded()); 1199 ASSERT_TRUE(WaitUntilOnEnded());
1200 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash()); 1200 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_2, GetAudioHash());
1201 } 1201 }
1202 1202
1203 TEST_F(PipelineIntegrationTest, 1203 TEST_F(PipelineIntegrationTest,
1204 MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay_MediaSource)) { 1204 MAYBE_CLOCKLESS(BasicPlaybackOpusPrerollExceedsCodecDelay_MediaSource)) {
1205 MockMediaSource source("bear-opus.webm", kOpusAudioOnlyWebM, 1205 MockMediaSource source("bear-opus.webm", kOpusAudioOnlyWebM,
1206 kAppendWholeFile); 1206 kAppendWholeFile);
1207 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource( 1207 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(
1208 &source, kClockless | kHashed, nullptr)); 1208 &source, kClockless | kHashed, nullptr));
1209 source.EndOfStream(); 1209 source.EndOfStream();
1210 1210
1211 AudioDecoderConfig config = 1211 AudioDecoderConfig config =
1212 demuxer_->GetStream(DemuxerStream::AUDIO)->audio_decoder_config(); 1212 demuxer_->GetFirstStream(DemuxerStream::AUDIO)->audio_decoder_config();
1213 1213
1214 // Verify that this file's preroll is not eclipsed by the codec delay so we 1214 // Verify that this file's preroll is not eclipsed by the codec delay so we
1215 // can detect when preroll is not properly performed. 1215 // can detect when preroll is not properly performed.
1216 base::TimeDelta codec_delay = base::TimeDelta::FromSecondsD( 1216 base::TimeDelta codec_delay = base::TimeDelta::FromSecondsD(
1217 static_cast<double>(config.codec_delay()) / config.samples_per_second()); 1217 static_cast<double>(config.codec_delay()) / config.samples_per_second());
1218 ASSERT_GT(config.seek_preroll(), codec_delay); 1218 ASSERT_GT(config.seek_preroll(), codec_delay);
1219 1219
1220 Play(); 1220 Play();
1221 ASSERT_TRUE(WaitUntilOnEnded()); 1221 ASSERT_TRUE(WaitUntilOnEnded());
1222 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash()); 1222 EXPECT_HASH_EQ(kOpusSmallCodecDelayHash_1, GetAudioHash());
(...skipping 1294 matching lines...) Expand 10 before | Expand all | Expand 10 after
2517 Play(); 2517 Play();
2518 ASSERT_TRUE(WaitUntilOnEnded()); 2518 ASSERT_TRUE(WaitUntilOnEnded());
2519 } 2519 }
2520 2520
2521 // Verify that OPUS audio in a webm which reports a 44.1kHz sample rate plays 2521 // Verify that OPUS audio in a webm which reports a 44.1kHz sample rate plays
2522 // correctly at 48kHz 2522 // correctly at 48kHz
2523 TEST_F(PipelineIntegrationTest, BasicPlayback_Opus441kHz) { 2523 TEST_F(PipelineIntegrationTest, BasicPlayback_Opus441kHz) {
2524 ASSERT_EQ(PIPELINE_OK, Start("sfx-opus-441.webm")); 2524 ASSERT_EQ(PIPELINE_OK, Start("sfx-opus-441.webm"));
2525 Play(); 2525 Play();
2526 ASSERT_TRUE(WaitUntilOnEnded()); 2526 ASSERT_TRUE(WaitUntilOnEnded());
2527 EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO) 2527
2528 EXPECT_EQ(48000, demuxer_->GetFirstStream(DemuxerStream::AUDIO)
2528 ->audio_decoder_config() 2529 ->audio_decoder_config()
2529 .samples_per_second()); 2530 .samples_per_second());
2530 } 2531 }
2531 2532
2532 // Same as above but using MediaSource. 2533 // Same as above but using MediaSource.
2533 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus441kHz) { 2534 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus441kHz) {
2534 MockMediaSource source("sfx-opus-441.webm", kOpusAudioOnlyWebM, 2535 MockMediaSource source("sfx-opus-441.webm", kOpusAudioOnlyWebM,
2535 kAppendWholeFile); 2536 kAppendWholeFile);
2536 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 2537 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
2537 source.EndOfStream(); 2538 source.EndOfStream();
2538 Play(); 2539 Play();
2539 ASSERT_TRUE(WaitUntilOnEnded()); 2540 ASSERT_TRUE(WaitUntilOnEnded());
2540 source.Shutdown(); 2541 source.Shutdown();
2541 Stop(); 2542 Stop();
2542 EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO) 2543 EXPECT_EQ(48000, demuxer_->GetFirstStream(DemuxerStream::AUDIO)
2543 ->audio_decoder_config() 2544 ->audio_decoder_config()
2544 .samples_per_second()); 2545 .samples_per_second());
2545 } 2546 }
2546 2547
2547 // Ensures audio-only playback with missing or negative timestamps works. Tests 2548 // Ensures audio-only playback with missing or negative timestamps works. Tests
2548 // the common live-streaming case for chained ogg. See http://crbug.com/396864. 2549 // the common live-streaming case for chained ogg. See http://crbug.com/396864.
2549 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOgg) { 2550 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOgg) {
2550 ASSERT_EQ(PIPELINE_OK, Start("double-sfx.ogg", kUnreliableDuration)); 2551 ASSERT_EQ(PIPELINE_OK, Start("double-sfx.ogg", kUnreliableDuration));
2551 Play(); 2552 Play();
2552 ASSERT_TRUE(WaitUntilOnEnded()); 2553 ASSERT_TRUE(WaitUntilOnEnded());
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
2584 2585
2585 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2586 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2586 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2587 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2587 Play(); 2588 Play();
2588 ASSERT_TRUE(WaitUntilOnEnded()); 2589 ASSERT_TRUE(WaitUntilOnEnded());
2589 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2590 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2590 demuxer_->GetStartTime()); 2591 demuxer_->GetStartTime());
2591 } 2592 }
2592 2593
2593 } // namespace media 2594 } // namespace media
OLDNEW
« no previous file with comments | « media/renderers/renderer_impl_unittest.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698