From 1abb4e18527d003909c12a529a03f332a22b47ee Mon Sep 17 00:00:00 2001 From: kmackay Date: Thu, 3 Mar 2016 11:45:53 -0800 Subject: [Chromecast] Fix some more media unit test issues * Don't set playback rate on "ignore PTS" streams. * Don't check PTS tracking on "ignore PTS" streams. * Sound effects streams must be "ignore PTS". BUG= internal b/27168097 Review URL: https://codereview.chromium.org/1762703003 Cr-Commit-Position: refs/heads/master@{#379061} --- .../audio_video_pipeline_device_unittest.cc | 48 +++++++++++++--------- 1 file changed, 29 insertions(+), 19 deletions(-) (limited to 'chromecast') diff --git a/chromecast/media/cma/backend/audio_video_pipeline_device_unittest.cc b/chromecast/media/cma/backend/audio_video_pipeline_device_unittest.cc index d5a93d6..7fd2d1d 100644 --- a/chromecast/media/cma/backend/audio_video_pipeline_device_unittest.cc +++ b/chromecast/media/cma/backend/audio_video_pipeline_device_unittest.cc @@ -719,6 +719,8 @@ void AudioVideoPipelineDeviceTest::RunStoppedChecks() { } void AudioVideoPipelineDeviceTest::RunPlaybackChecks() { + if (sync_type_ != MediaPipelineDeviceParams::kModeSyncPts) + return; RunStoppedChecks(); EXPECT_TRUE(backend_->SetPlaybackRate(1.0f)); @@ -760,25 +762,29 @@ void AudioVideoPipelineDeviceTest::MonitorLoop() { int64_t pts = backend_->GetCurrentPts(); base::TimeDelta media_time = base::TimeDelta::FromMicroseconds(pts); - - // Check that the current PTS is no more than 100ms past the last pushed PTS. - if (audio_feeder_ && - audio_feeder_->last_pushed_pts() != std::numeric_limits::min()) { - EXPECT_LE(pts, audio_feeder_->last_pushed_pts() + 100 * 1000); - } - if (video_feeder_ && - video_feeder_->last_pushed_pts() != std::numeric_limits::min()) { - EXPECT_LE(pts, video_feeder_->last_pushed_pts() + 100 * 1000); - } - // PTS is allowed to move backwards once to allow for updates when the first - // buffers are pushed. - if (!backwards_pts_change_) { - if (pts < last_pts_) - backwards_pts_change_ = true; - } else { - EXPECT_GE(pts, last_pts_); + if (sync_type_ == MediaPipelineDeviceParams::kModeSyncPts) { + // Check that the current PTS is no more than 100ms past the last pushed + // PTS. + if (audio_feeder_ && + audio_feeder_->last_pushed_pts() != + std::numeric_limits::min()) { + EXPECT_LE(pts, audio_feeder_->last_pushed_pts() + 100 * 1000); + } + if (video_feeder_ && + video_feeder_->last_pushed_pts() != + std::numeric_limits::min()) { + EXPECT_LE(pts, video_feeder_->last_pushed_pts() + 100 * 1000); + } + // PTS is allowed to move backwards once to allow for updates when the first + // buffers are pushed. + if (!backwards_pts_change_) { + if (pts < last_pts_) + backwards_pts_change_ = true; + } else { + EXPECT_GE(pts, last_pts_); + } + last_pts_ = pts; } - last_pts_ = pts; if (!pause_pattern_.empty() && pause_pattern_[pause_pattern_idx_].delay >= base::TimeDelta() && @@ -843,6 +849,10 @@ void AudioVideoPipelineDeviceTest::TestBackendStates() { base::MessageLoop::current()->RunUntilIdle(); RunPlaybackChecks(); + ASSERT_TRUE(backend()->Resume()); + base::MessageLoop::current()->RunUntilIdle(); + RunPlaybackChecks(); + ASSERT_TRUE(backend()->Stop()); base::MessageLoop::current()->RunUntilIdle(); @@ -991,11 +1001,11 @@ TEST_F(AudioVideoPipelineDeviceTest, AudioBackendStates) { TEST_F(AudioVideoPipelineDeviceTest, AudioEffectsBackendStates) { scoped_ptr message_loop(new base::MessageLoop()); set_audio_type(MediaPipelineDeviceParams::kAudioStreamSoundEffects); + set_sync_type(MediaPipelineDeviceParams::kModeIgnorePts); Initialize(); MediaPipelineBackend::AudioDecoder* audio_decoder = backend()->CreateAudioDecoder(); - // Test setting config before Initialize(). scoped_ptr feeder(new BufferFeeder(base::Bind(&IgnoreEos))); feeder->Initialize(backend(), audio_decoder, BufferList()); feeder->SetAudioConfig(DefaultAudioConfig()); -- cgit v1.1