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

Side by Side Diff: media/base/pipeline_unittest.cc

Issue 390733002: Revert of Remove media::VideoRenderer::SetPlaybackRate(). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 5 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 | Annotate | Revision Log
« no previous file with comments | « media/base/pipeline.cc ('k') | media/base/video_renderer.h » ('j') | 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 <vector> 5 #include <vector>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/message_loop/message_loop.h" 8 #include "base/message_loop/message_loop.h"
9 #include "base/stl_util.h" 9 #include "base/stl_util.h"
10 #include "base/test/simple_test_tick_clock.h" 10 #include "base/test/simple_test_tick_clock.h"
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 if (audio_stream_) { 201 if (audio_stream_) {
202 EXPECT_CALL(*audio_renderer_, SetPlaybackRate(0.0f)); 202 EXPECT_CALL(*audio_renderer_, SetPlaybackRate(0.0f));
203 EXPECT_CALL(*audio_renderer_, SetVolume(1.0f)); 203 EXPECT_CALL(*audio_renderer_, SetVolume(1.0f));
204 EXPECT_CALL(*audio_renderer_, StartPlayingFrom(base::TimeDelta())) 204 EXPECT_CALL(*audio_renderer_, StartPlayingFrom(base::TimeDelta()))
205 .WillOnce(SetBufferingState(&audio_buffering_state_cb_, 205 .WillOnce(SetBufferingState(&audio_buffering_state_cb_,
206 BUFFERING_HAVE_ENOUGH)); 206 BUFFERING_HAVE_ENOUGH));
207 EXPECT_CALL(*audio_renderer_, StartRendering()); 207 EXPECT_CALL(*audio_renderer_, StartRendering());
208 } 208 }
209 209
210 if (video_stream_) { 210 if (video_stream_) {
211 EXPECT_CALL(*video_renderer_, SetPlaybackRate(0.0f));
211 EXPECT_CALL(*video_renderer_, StartPlayingFrom(base::TimeDelta())) 212 EXPECT_CALL(*video_renderer_, StartPlayingFrom(base::TimeDelta()))
212 .WillOnce(SetBufferingState(&video_buffering_state_cb_, 213 .WillOnce(SetBufferingState(&video_buffering_state_cb_,
213 BUFFERING_HAVE_ENOUGH)); 214 BUFFERING_HAVE_ENOUGH));
214 } 215 }
215 216
216 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)); 217 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH));
217 } 218 }
218 219
219 pipeline_->Start( 220 pipeline_->Start(
220 filter_collection_.Pass(), 221 filter_collection_.Pass(),
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 } 278 }
278 279
279 if (video_stream_) { 280 if (video_stream_) {
280 EXPECT_CALL(*video_renderer_, Flush(_)) 281 EXPECT_CALL(*video_renderer_, Flush(_))
281 .WillOnce(DoAll(SetBufferingState(&video_buffering_state_cb_, 282 .WillOnce(DoAll(SetBufferingState(&video_buffering_state_cb_,
282 BUFFERING_HAVE_NOTHING), 283 BUFFERING_HAVE_NOTHING),
283 RunClosure<0>())); 284 RunClosure<0>()));
284 EXPECT_CALL(*video_renderer_, StartPlayingFrom(seek_time)) 285 EXPECT_CALL(*video_renderer_, StartPlayingFrom(seek_time))
285 .WillOnce(SetBufferingState(&video_buffering_state_cb_, 286 .WillOnce(SetBufferingState(&video_buffering_state_cb_,
286 BUFFERING_HAVE_ENOUGH)); 287 BUFFERING_HAVE_ENOUGH));
288 EXPECT_CALL(*video_renderer_, SetPlaybackRate(_));
287 } 289 }
288 290
289 // We expect a successful seek callback followed by a buffering update. 291 // We expect a successful seek callback followed by a buffering update.
290 EXPECT_CALL(callbacks_, OnSeek(PIPELINE_OK)); 292 EXPECT_CALL(callbacks_, OnSeek(PIPELINE_OK));
291 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)); 293 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH));
292 } 294 }
293 295
294 void DoSeek(const base::TimeDelta& seek_time) { 296 void DoSeek(const base::TimeDelta& seek_time) {
295 pipeline_->Seek(seek_time, 297 pipeline_->Seek(seek_time,
296 base::Bind(&CallbackHelper::OnSeek, 298 base::Bind(&CallbackHelper::OnSeek,
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after
622 new TimeDeltaInterpolator(&test_tick_clock_)); 624 new TimeDeltaInterpolator(&test_tick_clock_));
623 625
624 InitializeDemuxer(&streams, duration); 626 InitializeDemuxer(&streams, duration);
625 InitializeAudioRenderer(audio_stream()); 627 InitializeAudioRenderer(audio_stream());
626 InitializeVideoRenderer(video_stream()); 628 InitializeVideoRenderer(video_stream());
627 InitializePipeline(PIPELINE_OK); 629 InitializePipeline(PIPELINE_OK);
628 630
629 EXPECT_EQ(0, pipeline_->GetMediaTime().ToInternalValue()); 631 EXPECT_EQ(0, pipeline_->GetMediaTime().ToInternalValue());
630 632
631 float playback_rate = 1.0f; 633 float playback_rate = 1.0f;
634 EXPECT_CALL(*video_renderer_, SetPlaybackRate(playback_rate));
632 EXPECT_CALL(*audio_renderer_, SetPlaybackRate(playback_rate)); 635 EXPECT_CALL(*audio_renderer_, SetPlaybackRate(playback_rate));
633 pipeline_->SetPlaybackRate(playback_rate); 636 pipeline_->SetPlaybackRate(playback_rate);
634 message_loop_.RunUntilIdle(); 637 message_loop_.RunUntilIdle();
635 638
636 InSequence s; 639 InSequence s;
637 640
638 // Verify that the clock doesn't advance since it hasn't been started by 641 // Verify that the clock doesn't advance since it hasn't been started by
639 // a time update from the audio stream. 642 // a time update from the audio stream.
640 int64 start_time = pipeline_->GetMediaTime().ToInternalValue(); 643 int64 start_time = pipeline_->GetMediaTime().ToInternalValue();
641 test_tick_clock_.Advance(base::TimeDelta::FromMilliseconds(100)); 644 test_tick_clock_.Advance(base::TimeDelta::FromMilliseconds(100));
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after
990 993
991 // If we get here it's a successful initialization. 994 // If we get here it's a successful initialization.
992 EXPECT_CALL(*audio_renderer_, StartPlayingFrom(base::TimeDelta())) 995 EXPECT_CALL(*audio_renderer_, StartPlayingFrom(base::TimeDelta()))
993 .WillOnce(SetBufferingState(&audio_buffering_state_cb_, 996 .WillOnce(SetBufferingState(&audio_buffering_state_cb_,
994 BUFFERING_HAVE_ENOUGH)); 997 BUFFERING_HAVE_ENOUGH));
995 EXPECT_CALL(*video_renderer_, StartPlayingFrom(base::TimeDelta())) 998 EXPECT_CALL(*video_renderer_, StartPlayingFrom(base::TimeDelta()))
996 .WillOnce(SetBufferingState(&video_buffering_state_cb_, 999 .WillOnce(SetBufferingState(&video_buffering_state_cb_,
997 BUFFERING_HAVE_ENOUGH)); 1000 BUFFERING_HAVE_ENOUGH));
998 1001
999 EXPECT_CALL(*audio_renderer_, SetPlaybackRate(0.0f)); 1002 EXPECT_CALL(*audio_renderer_, SetPlaybackRate(0.0f));
1003 EXPECT_CALL(*video_renderer_, SetPlaybackRate(0.0f));
1000 EXPECT_CALL(*audio_renderer_, SetVolume(1.0f)); 1004 EXPECT_CALL(*audio_renderer_, SetVolume(1.0f));
1001 EXPECT_CALL(*audio_renderer_, StartRendering()); 1005 EXPECT_CALL(*audio_renderer_, StartRendering());
1002 1006
1003 if (status == PIPELINE_OK) 1007 if (status == PIPELINE_OK)
1004 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)); 1008 EXPECT_CALL(callbacks_, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH));
1005 1009
1006 return status; 1010 return status;
1007 } 1011 }
1008 1012
1009 void DoSeek(TeardownState state, StopOrError stop_or_error) { 1013 void DoSeek(TeardownState state, StopOrError stop_or_error) {
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
1126 INSTANTIATE_TEARDOWN_TEST(Error, InitDemuxer); 1130 INSTANTIATE_TEARDOWN_TEST(Error, InitDemuxer);
1127 INSTANTIATE_TEARDOWN_TEST(Error, InitAudioRenderer); 1131 INSTANTIATE_TEARDOWN_TEST(Error, InitAudioRenderer);
1128 INSTANTIATE_TEARDOWN_TEST(Error, InitVideoRenderer); 1132 INSTANTIATE_TEARDOWN_TEST(Error, InitVideoRenderer);
1129 INSTANTIATE_TEARDOWN_TEST(Error, Flushing); 1133 INSTANTIATE_TEARDOWN_TEST(Error, Flushing);
1130 INSTANTIATE_TEARDOWN_TEST(Error, Seeking); 1134 INSTANTIATE_TEARDOWN_TEST(Error, Seeking);
1131 INSTANTIATE_TEARDOWN_TEST(Error, Playing); 1135 INSTANTIATE_TEARDOWN_TEST(Error, Playing);
1132 1136
1133 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing); 1137 INSTANTIATE_TEARDOWN_TEST(ErrorAndStop, Playing);
1134 1138
1135 } // namespace media 1139 } // namespace media
OLDNEW
« no previous file with comments | « media/base/pipeline.cc ('k') | media/base/video_renderer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698