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

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

Issue 2667283002: Refactor MediaResource to be multi-stream capable (Closed)
Patch Set: 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 1162 matching lines...) Expand 10 before | Expand all | Expand 10 after
1173 ASSERT_TRUE(Seek(seek_time)); 1173 ASSERT_TRUE(Seek(seek_time));
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 EXPECT_EQ(1u, demuxer_->GetStreams().size());
1184 demuxer_->GetStream(DemuxerStream::AUDIO)->audio_decoder_config(); 1184 AudioDecoderConfig config = demuxer_->GetStreams()[0]->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 EXPECT_EQ(1u, demuxer_->GetStreams().size());
1212 demuxer_->GetStream(DemuxerStream::AUDIO)->audio_decoder_config(); 1212 AudioDecoderConfig config = demuxer_->GetStreams()[0]->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 ->audio_decoder_config() 2528 EXPECT_EQ(1u, demuxer_->GetStreams().size());
2529 .samples_per_second()); 2529 EXPECT_EQ(
2530 48000,
2531 demuxer_->GetStreams()[0]->audio_decoder_config().samples_per_second());
2530 } 2532 }
2531 2533
2532 // Same as above but using MediaSource. 2534 // Same as above but using MediaSource.
2533 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus441kHz) { 2535 TEST_F(PipelineIntegrationTest, BasicPlayback_MediaSource_Opus441kHz) {
2534 MockMediaSource source("sfx-opus-441.webm", kOpusAudioOnlyWebM, 2536 MockMediaSource source("sfx-opus-441.webm", kOpusAudioOnlyWebM,
2535 kAppendWholeFile); 2537 kAppendWholeFile);
2536 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source)); 2538 EXPECT_EQ(PIPELINE_OK, StartPipelineWithMediaSource(&source));
2537 source.EndOfStream(); 2539 source.EndOfStream();
2538 Play(); 2540 Play();
2539 ASSERT_TRUE(WaitUntilOnEnded()); 2541 ASSERT_TRUE(WaitUntilOnEnded());
2540 source.Shutdown(); 2542 source.Shutdown();
2541 Stop(); 2543 Stop();
2542 EXPECT_EQ(48000, demuxer_->GetStream(DemuxerStream::AUDIO) 2544 EXPECT_EQ(1u, demuxer_->GetStreams().size());
2543 ->audio_decoder_config() 2545 EXPECT_EQ(
2544 .samples_per_second()); 2546 48000,
2547 demuxer_->GetStreams()[0]->audio_decoder_config().samples_per_second());
2545 } 2548 }
2546 2549
2547 // Ensures audio-only playback with missing or negative timestamps works. Tests 2550 // 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. 2551 // the common live-streaming case for chained ogg. See http://crbug.com/396864.
2549 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOgg) { 2552 TEST_F(PipelineIntegrationTest, BasicPlaybackChainedOgg) {
2550 ASSERT_EQ(PIPELINE_OK, Start("double-sfx.ogg", kUnreliableDuration)); 2553 ASSERT_EQ(PIPELINE_OK, Start("double-sfx.ogg", kUnreliableDuration));
2551 Play(); 2554 Play();
2552 ASSERT_TRUE(WaitUntilOnEnded()); 2555 ASSERT_TRUE(WaitUntilOnEnded());
2553 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime()); 2556 ASSERT_EQ(base::TimeDelta(), demuxer_->GetStartTime());
2554 } 2557 }
(...skipping 29 matching lines...) Expand all
2584 2587
2585 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) { 2588 TEST_F(PipelineIntegrationTest, BasicPlaybackPositiveStartTime) {
2586 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm")); 2589 ASSERT_EQ(PIPELINE_OK, Start("nonzero-start-time.webm"));
2587 Play(); 2590 Play();
2588 ASSERT_TRUE(WaitUntilOnEnded()); 2591 ASSERT_TRUE(WaitUntilOnEnded());
2589 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000), 2592 ASSERT_EQ(base::TimeDelta::FromMicroseconds(396000),
2590 demuxer_->GetStartTime()); 2593 demuxer_->GetStartTime());
2591 } 2594 }
2592 2595
2593 } // namespace media 2596 } // 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