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

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

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

Powered by Google App Engine
This is Rietveld 408576698