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

Unified Diff: media/filters/audio_renderer_impl_unittest.cc

Issue 256163005: Introduce AudioClock to improve playback delay calculations. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix eos Created 6 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/filters/audio_renderer_impl.cc ('k') | media/media.gyp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/filters/audio_renderer_impl_unittest.cc
diff --git a/media/filters/audio_renderer_impl_unittest.cc b/media/filters/audio_renderer_impl_unittest.cc
index 1ae27e35f48eb6b5b6d23fea5f2b65b53cdb1249..4231d923f7d2b304cdbbc4e42f344f6b0d5efe59 100644
--- a/media/filters/audio_renderer_impl_unittest.cc
+++ b/media/filters/audio_renderer_impl_unittest.cc
@@ -969,15 +969,33 @@ TEST_F(AudioRendererImplTest, TimeUpdatesOnFirstBuffer) {
EXPECT_TRUE(ConsumeBufferedData(kFramesToConsume, NULL));
WaitForPendingRead();
- // Ensure we received a time update for the first buffer and it's zero.
+ // ConsumeBufferedData() uses an audio delay of zero, so ensure we received
+ // a time update that's equal to |kFramesToConsume| from above.
timestamp_helper.SetBaseTimestamp(base::TimeDelta());
- EXPECT_EQ(timestamp_helper.base_timestamp(), last_time_update());
timestamp_helper.AddFrames(kFramesToConsume);
+ EXPECT_EQ(timestamp_helper.GetTimestamp(), last_time_update());
- // ConsumeBufferedData() uses an audio delay of zero, so the next buffer
- // should have a timestamp equal to the duration of |kFramesToConsume|.
+ // The next time update should match the remaining frames_buffered().
+ timestamp_helper.AddFrames(frames_buffered());
EXPECT_TRUE(ConsumeBufferedData(frames_buffered(), NULL));
EXPECT_EQ(timestamp_helper.GetTimestamp(), last_time_update());
}
+TEST_F(AudioRendererImplTest, ImmediateEndOfStream) {
+ Initialize();
+ {
+ SCOPED_TRACE("Preroll()");
+ WaitableMessageLoopEvent event;
+ renderer_->Preroll(base::TimeDelta(), event.GetPipelineStatusCB());
+ WaitForPendingRead();
+ DeliverEndOfStream();
+ event.RunAndWaitForStatus(PIPELINE_OK);
+ }
+ Play();
+
+ // Read a single frame. We shouldn't be able to satisfy it.
+ EXPECT_FALSE(ConsumeBufferedData(1, NULL));
+ WaitForEnded();
+}
+
} // namespace media
« no previous file with comments | « media/filters/audio_renderer_impl.cc ('k') | media/media.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698