| OLD | NEW |
| 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 "media/test/pipeline_integration_test_base.h" | 5 #include "media/test/pipeline_integration_test_base.h" |
| 6 | 6 |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 99 |
| 100 private: | 100 private: |
| 101 PipelineIntegrationTestBase* integration_test_; | 101 PipelineIntegrationTestBase* integration_test_; |
| 102 | 102 |
| 103 DISALLOW_COPY_AND_ASSIGN(RendererFactoryImpl); | 103 DISALLOW_COPY_AND_ASSIGN(RendererFactoryImpl); |
| 104 }; | 104 }; |
| 105 | 105 |
| 106 PipelineIntegrationTestBase::PipelineIntegrationTestBase() | 106 PipelineIntegrationTestBase::PipelineIntegrationTestBase() |
| 107 : hashing_enabled_(false), | 107 : hashing_enabled_(false), |
| 108 clockless_playback_(false), | 108 clockless_playback_(false), |
| 109 pipeline_(new PipelineImpl(message_loop_.task_runner(), &media_log_)), | 109 pipeline_(new PipelineImpl(main_thread_task_runner_, &media_log_)), |
| 110 ended_(false), | 110 ended_(false), |
| 111 pipeline_status_(PIPELINE_OK), | 111 pipeline_status_(PIPELINE_OK), |
| 112 last_video_frame_format_(PIXEL_FORMAT_UNKNOWN), | 112 last_video_frame_format_(PIXEL_FORMAT_UNKNOWN), |
| 113 last_video_frame_color_space_(COLOR_SPACE_UNSPECIFIED), | 113 last_video_frame_color_space_(COLOR_SPACE_UNSPECIFIED), |
| 114 current_duration_(kInfiniteDuration), | 114 current_duration_(kInfiniteDuration), |
| 115 renderer_factory_(new RendererFactoryImpl(this)) { | 115 renderer_factory_(new RendererFactoryImpl(this)) { |
| 116 ResetVideoHash(); | 116 ResetVideoHash(); |
| 117 EXPECT_CALL(*this, OnVideoAverageKeyframeDistanceUpdate()).Times(AnyNumber()); | 117 EXPECT_CALL(*this, OnVideoAverageKeyframeDistanceUpdate()).Times(AnyNumber()); |
| 118 } | 118 } |
| 119 | 119 |
| 120 PipelineIntegrationTestBase::~PipelineIntegrationTestBase() { | 120 PipelineIntegrationTestBase::~PipelineIntegrationTestBase() { |
| 121 if (pipeline_->IsRunning()) | 121 if (pipeline_->IsRunning()) |
| 122 Stop(); | 122 Stop(); |
| 123 | 123 |
| 124 demuxer_.reset(); | 124 demuxer_.reset(); |
| 125 pipeline_.reset(); | 125 pipeline_.reset(); |
| 126 base::RunLoop().RunUntilIdle(); | 126 base::RunLoop().RunUntilIdle(); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // TODO(xhwang): Method definitions in this file needs to be reordered. | 129 // TODO(xhwang): Method definitions in this file needs to be reordered. |
| 130 | 130 |
| 131 void PipelineIntegrationTestBase::OnSeeked(base::TimeDelta seek_time, | 131 void PipelineIntegrationTestBase::OnSeeked(base::TimeDelta seek_time, |
| 132 PipelineStatus status) { | 132 PipelineStatus status) { |
| 133 EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); | 133 EXPECT_EQ(seek_time, pipeline_->GetMediaTime()); |
| 134 pipeline_status_ = status; | 134 pipeline_status_ = status; |
| 135 } | 135 } |
| 136 | 136 |
| 137 void PipelineIntegrationTestBase::OnStatusCallback(PipelineStatus status) { | 137 void PipelineIntegrationTestBase::OnStatusCallback(PipelineStatus status) { |
| 138 pipeline_status_ = status; | 138 pipeline_status_ = status; |
| 139 message_loop_.task_runner()->PostTask( | 139 main_thread_task_runner_->PostTask(FROM_HERE, |
| 140 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 140 base::MessageLoop::QuitWhenIdleClosure()); |
| 141 } | 141 } |
| 142 | 142 |
| 143 void PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB( | 143 void PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB( |
| 144 EmeInitDataType type, | 144 EmeInitDataType type, |
| 145 const std::vector<uint8_t>& init_data) { | 145 const std::vector<uint8_t>& init_data) { |
| 146 DCHECK(!init_data.empty()); | 146 DCHECK(!init_data.empty()); |
| 147 CHECK(!encrypted_media_init_data_cb_.is_null()); | 147 CHECK(!encrypted_media_init_data_cb_.is_null()); |
| 148 encrypted_media_init_data_cb_.Run(type, init_data); | 148 encrypted_media_init_data_cb_.Run(type, init_data); |
| 149 } | 149 } |
| 150 | 150 |
| 151 void PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB( | 151 void PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB( |
| 152 std::unique_ptr<MediaTracks> tracks) { | 152 std::unique_ptr<MediaTracks> tracks) { |
| 153 CHECK(tracks); | 153 CHECK(tracks); |
| 154 CHECK_GT(tracks->tracks().size(), 0u); | 154 CHECK_GT(tracks->tracks().size(), 0u); |
| 155 | 155 |
| 156 // Verify that track ids are unique. | 156 // Verify that track ids are unique. |
| 157 std::set<MediaTrack::Id> track_ids; | 157 std::set<MediaTrack::Id> track_ids; |
| 158 for (const auto& track : tracks->tracks()) { | 158 for (const auto& track : tracks->tracks()) { |
| 159 EXPECT_EQ(track_ids.end(), track_ids.find(track->id())); | 159 EXPECT_EQ(track_ids.end(), track_ids.find(track->id())); |
| 160 track_ids.insert(track->id()); | 160 track_ids.insert(track->id()); |
| 161 } | 161 } |
| 162 } | 162 } |
| 163 | 163 |
| 164 void PipelineIntegrationTestBase::OnEnded() { | 164 void PipelineIntegrationTestBase::OnEnded() { |
| 165 DCHECK(!ended_); | 165 DCHECK(!ended_); |
| 166 ended_ = true; | 166 ended_ = true; |
| 167 pipeline_status_ = PIPELINE_OK; | 167 pipeline_status_ = PIPELINE_OK; |
| 168 message_loop_.task_runner()->PostTask( | 168 main_thread_task_runner_->PostTask(FROM_HERE, |
| 169 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 169 base::MessageLoop::QuitWhenIdleClosure()); |
| 170 } | 170 } |
| 171 | 171 |
| 172 bool PipelineIntegrationTestBase::WaitUntilOnEnded() { | 172 bool PipelineIntegrationTestBase::WaitUntilOnEnded() { |
| 173 if (ended_) | 173 if (ended_) |
| 174 return (pipeline_status_ == PIPELINE_OK); | 174 return (pipeline_status_ == PIPELINE_OK); |
| 175 base::RunLoop().Run(); | 175 base::RunLoop().Run(); |
| 176 EXPECT_TRUE(ended_); | 176 EXPECT_TRUE(ended_); |
| 177 return ended_ && (pipeline_status_ == PIPELINE_OK); | 177 return ended_ && (pipeline_status_ == PIPELINE_OK); |
| 178 } | 178 } |
| 179 | 179 |
| 180 PipelineStatus PipelineIntegrationTestBase::WaitUntilEndedOrError() { | 180 PipelineStatus PipelineIntegrationTestBase::WaitUntilEndedOrError() { |
| 181 if (ended_ || pipeline_status_ != PIPELINE_OK) | 181 if (ended_ || pipeline_status_ != PIPELINE_OK) |
| 182 return pipeline_status_; | 182 return pipeline_status_; |
| 183 base::RunLoop().Run(); | 183 base::RunLoop().Run(); |
| 184 return pipeline_status_; | 184 return pipeline_status_; |
| 185 } | 185 } |
| 186 | 186 |
| 187 void PipelineIntegrationTestBase::OnError(PipelineStatus status) { | 187 void PipelineIntegrationTestBase::OnError(PipelineStatus status) { |
| 188 DCHECK_NE(status, PIPELINE_OK); | 188 DCHECK_NE(status, PIPELINE_OK); |
| 189 pipeline_status_ = status; | 189 pipeline_status_ = status; |
| 190 message_loop_.task_runner()->PostTask( | 190 main_thread_task_runner_->PostTask(FROM_HERE, |
| 191 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); | 191 base::MessageLoop::QuitWhenIdleClosure()); |
| 192 } | 192 } |
| 193 | 193 |
| 194 PipelineStatus PipelineIntegrationTestBase::StartInternal( | 194 PipelineStatus PipelineIntegrationTestBase::StartInternal( |
| 195 std::unique_ptr<DataSource> data_source, | 195 std::unique_ptr<DataSource> data_source, |
| 196 CdmContext* cdm_context, | 196 CdmContext* cdm_context, |
| 197 uint8_t test_type, | 197 uint8_t test_type, |
| 198 CreateVideoDecodersCB prepend_video_decoders_cb, | 198 CreateVideoDecodersCB prepend_video_decoders_cb, |
| 199 CreateAudioDecodersCB prepend_audio_decoders_cb) { | 199 CreateAudioDecodersCB prepend_audio_decoders_cb) { |
| 200 hashing_enabled_ = test_type & kHashed; | 200 hashing_enabled_ = test_type & kHashed; |
| 201 clockless_playback_ = test_type & kClockless; | 201 clockless_playback_ = test_type & kClockless; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 291 pipeline_->SetPlaybackRate(1); | 291 pipeline_->SetPlaybackRate(1); |
| 292 } | 292 } |
| 293 | 293 |
| 294 void PipelineIntegrationTestBase::Pause() { | 294 void PipelineIntegrationTestBase::Pause() { |
| 295 pipeline_->SetPlaybackRate(0); | 295 pipeline_->SetPlaybackRate(0); |
| 296 } | 296 } |
| 297 | 297 |
| 298 bool PipelineIntegrationTestBase::Seek(base::TimeDelta seek_time) { | 298 bool PipelineIntegrationTestBase::Seek(base::TimeDelta seek_time) { |
| 299 ended_ = false; | 299 ended_ = false; |
| 300 | 300 |
| 301 base::RunLoop run_loop; |
| 301 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)) | 302 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
| 302 .WillOnce(InvokeWithoutArgs(&message_loop_, &base::MessageLoop::QuitNow)); | 303 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
| 303 pipeline_->Seek(seek_time, base::Bind(&PipelineIntegrationTestBase::OnSeeked, | 304 pipeline_->Seek(seek_time, base::Bind(&PipelineIntegrationTestBase::OnSeeked, |
| 304 base::Unretained(this), seek_time)); | 305 base::Unretained(this), seek_time)); |
| 305 base::RunLoop().Run(); | 306 run_loop.Run(); |
| 306 EXPECT_CALL(*this, OnBufferingStateChange(_)).Times(AnyNumber()); | 307 EXPECT_CALL(*this, OnBufferingStateChange(_)).Times(AnyNumber()); |
| 307 return (pipeline_status_ == PIPELINE_OK); | 308 return (pipeline_status_ == PIPELINE_OK); |
| 308 } | 309 } |
| 309 | 310 |
| 310 bool PipelineIntegrationTestBase::Suspend() { | 311 bool PipelineIntegrationTestBase::Suspend() { |
| 311 pipeline_->Suspend(base::Bind(&PipelineIntegrationTestBase::OnStatusCallback, | 312 pipeline_->Suspend(base::Bind(&PipelineIntegrationTestBase::OnStatusCallback, |
| 312 base::Unretained(this))); | 313 base::Unretained(this))); |
| 313 base::RunLoop().Run(); | 314 base::RunLoop().Run(); |
| 314 return (pipeline_status_ == PIPELINE_OK); | 315 return (pipeline_status_ == PIPELINE_OK); |
| 315 } | 316 } |
| 316 | 317 |
| 317 bool PipelineIntegrationTestBase::Resume(base::TimeDelta seek_time) { | 318 bool PipelineIntegrationTestBase::Resume(base::TimeDelta seek_time) { |
| 318 ended_ = false; | 319 ended_ = false; |
| 319 | 320 |
| 321 base::RunLoop run_loop; |
| 320 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)) | 322 EXPECT_CALL(*this, OnBufferingStateChange(BUFFERING_HAVE_ENOUGH)) |
| 321 .WillOnce(InvokeWithoutArgs(&message_loop_, &base::MessageLoop::QuitNow)); | 323 .WillOnce(InvokeWithoutArgs(&run_loop, &base::RunLoop::Quit)); |
| 322 pipeline_->Resume(renderer_factory_->CreateRenderer(CreateVideoDecodersCB(), | 324 pipeline_->Resume(renderer_factory_->CreateRenderer(CreateVideoDecodersCB(), |
| 323 CreateAudioDecodersCB()), | 325 CreateAudioDecodersCB()), |
| 324 seek_time, | 326 seek_time, |
| 325 base::Bind(&PipelineIntegrationTestBase::OnSeeked, | 327 base::Bind(&PipelineIntegrationTestBase::OnSeeked, |
| 326 base::Unretained(this), seek_time)); | 328 base::Unretained(this), seek_time)); |
| 327 base::RunLoop().Run(); | 329 run_loop.Run(); |
| 328 return (pipeline_status_ == PIPELINE_OK); | 330 return (pipeline_status_ == PIPELINE_OK); |
| 329 } | 331 } |
| 330 | 332 |
| 331 void PipelineIntegrationTestBase::Stop() { | 333 void PipelineIntegrationTestBase::Stop() { |
| 332 DCHECK(pipeline_->IsRunning()); | 334 DCHECK(pipeline_->IsRunning()); |
| 333 pipeline_->Stop(); | 335 pipeline_->Stop(); |
| 334 base::RunLoop().RunUntilIdle(); | 336 base::RunLoop().RunUntilIdle(); |
| 335 } | 337 } |
| 336 | 338 |
| 337 void PipelineIntegrationTestBase::FailTest(PipelineStatus status) { | 339 void PipelineIntegrationTestBase::FailTest(PipelineStatus status) { |
| 338 DCHECK_NE(PIPELINE_OK, status); | 340 DCHECK_NE(PIPELINE_OK, status); |
| 339 OnError(status); | 341 OnError(status); |
| 340 } | 342 } |
| 341 | 343 |
| 342 void PipelineIntegrationTestBase::QuitAfterCurrentTimeTask( | 344 void PipelineIntegrationTestBase::QuitAfterCurrentTimeTask( |
| 343 const base::TimeDelta& quit_time) { | 345 const base::TimeDelta& quit_time) { |
| 344 if (pipeline_->GetMediaTime() >= quit_time || | 346 if (pipeline_->GetMediaTime() >= quit_time || |
| 345 pipeline_status_ != PIPELINE_OK) { | 347 pipeline_status_ != PIPELINE_OK) { |
| 346 message_loop_.QuitWhenIdle(); | 348 base::MessageLoop::current()->QuitWhenIdle(); |
| 347 return; | 349 return; |
| 348 } | 350 } |
| 349 | 351 |
| 350 message_loop_.task_runner()->PostDelayedTask( | 352 main_thread_task_runner_->PostDelayedTask( |
| 351 FROM_HERE, | 353 FROM_HERE, |
| 352 base::Bind(&PipelineIntegrationTestBase::QuitAfterCurrentTimeTask, | 354 base::Bind(&PipelineIntegrationTestBase::QuitAfterCurrentTimeTask, |
| 353 base::Unretained(this), quit_time), | 355 base::Unretained(this), quit_time), |
| 354 base::TimeDelta::FromMilliseconds(10)); | 356 base::TimeDelta::FromMilliseconds(10)); |
| 355 } | 357 } |
| 356 | 358 |
| 357 bool PipelineIntegrationTestBase::WaitUntilCurrentTimeIsAfter( | 359 bool PipelineIntegrationTestBase::WaitUntilCurrentTimeIsAfter( |
| 358 const base::TimeDelta& wait_time) { | 360 const base::TimeDelta& wait_time) { |
| 359 DCHECK(pipeline_->IsRunning()); | 361 DCHECK(pipeline_->IsRunning()); |
| 360 DCHECK_GT(pipeline_->GetPlaybackRate(), 0); | 362 DCHECK_GT(pipeline_->GetPlaybackRate(), 0); |
| 361 DCHECK(wait_time <= pipeline_->GetMediaDuration()); | 363 DCHECK(wait_time <= pipeline_->GetMediaDuration()); |
| 362 | 364 |
| 363 message_loop_.task_runner()->PostDelayedTask( | 365 main_thread_task_runner_->PostDelayedTask( |
| 364 FROM_HERE, | 366 FROM_HERE, |
| 365 base::Bind(&PipelineIntegrationTestBase::QuitAfterCurrentTimeTask, | 367 base::Bind(&PipelineIntegrationTestBase::QuitAfterCurrentTimeTask, |
| 366 base::Unretained(this), wait_time), | 368 base::Unretained(this), wait_time), |
| 367 base::TimeDelta::FromMilliseconds(10)); | 369 base::TimeDelta::FromMilliseconds(10)); |
| 368 base::RunLoop().Run(); | 370 base::RunLoop().Run(); |
| 369 return (pipeline_status_ == PIPELINE_OK); | 371 return (pipeline_status_ == PIPELINE_OK); |
| 370 } | 372 } |
| 371 | 373 |
| 372 void PipelineIntegrationTestBase::CreateDemuxer( | 374 void PipelineIntegrationTestBase::CreateDemuxer( |
| 373 std::unique_ptr<DataSource> data_source) { | 375 std::unique_ptr<DataSource> data_source) { |
| 374 data_source_ = std::move(data_source); | 376 data_source_ = std::move(data_source); |
| 375 | 377 |
| 376 #if !defined(MEDIA_DISABLE_FFMPEG) | 378 #if !defined(MEDIA_DISABLE_FFMPEG) |
| 377 task_scheduler_.reset(new base::test::ScopedTaskScheduler(&message_loop_)); | |
| 378 demuxer_ = std::unique_ptr<Demuxer>(new FFmpegDemuxer( | 379 demuxer_ = std::unique_ptr<Demuxer>(new FFmpegDemuxer( |
| 379 message_loop_.task_runner(), data_source_.get(), | 380 main_thread_task_runner_, data_source_.get(), |
| 380 base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB, | 381 base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB, |
| 381 base::Unretained(this)), | 382 base::Unretained(this)), |
| 382 base::Bind(&PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB, | 383 base::Bind(&PipelineIntegrationTestBase::DemuxerMediaTracksUpdatedCB, |
| 383 base::Unretained(this)), | 384 base::Unretained(this)), |
| 384 &media_log_)); | 385 &media_log_)); |
| 385 #endif | 386 #endif |
| 386 } | 387 } |
| 387 | 388 |
| 388 std::unique_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer( | 389 std::unique_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer( |
| 389 CreateVideoDecodersCB prepend_video_decoders_cb, | 390 CreateVideoDecodersCB prepend_video_decoders_cb, |
| 390 CreateAudioDecodersCB prepend_audio_decoders_cb) { | 391 CreateAudioDecodersCB prepend_audio_decoders_cb) { |
| 391 // Simulate a 60Hz rendering sink. | 392 // Simulate a 60Hz rendering sink. |
| 392 video_sink_.reset(new NullVideoSink( | 393 video_sink_.reset(new NullVideoSink( |
| 393 clockless_playback_, base::TimeDelta::FromSecondsD(1.0 / 60), | 394 clockless_playback_, base::TimeDelta::FromSecondsD(1.0 / 60), |
| 394 base::Bind(&PipelineIntegrationTestBase::OnVideoFramePaint, | 395 base::Bind(&PipelineIntegrationTestBase::OnVideoFramePaint, |
| 395 base::Unretained(this)), | 396 base::Unretained(this)), |
| 396 message_loop_.task_runner())); | 397 main_thread_task_runner_)); |
| 397 | 398 |
| 398 // Disable frame dropping if hashing is enabled. | 399 // Disable frame dropping if hashing is enabled. |
| 399 std::unique_ptr<VideoRenderer> video_renderer(new VideoRendererImpl( | 400 std::unique_ptr<VideoRenderer> video_renderer( |
| 400 message_loop_.task_runner(), message_loop_.task_runner().get(), | 401 new VideoRendererImpl(main_thread_task_runner_, |
| 401 video_sink_.get(), | 402 main_thread_task_runner_.get(), video_sink_.get(), |
| 402 base::Bind(&CreateVideoDecodersForTest, &media_log_, | 403 base::Bind(&CreateVideoDecodersForTest, &media_log_, |
| 403 prepend_video_decoders_cb), | 404 prepend_video_decoders_cb), |
| 404 false, nullptr, &media_log_)); | 405 false, nullptr, &media_log_)); |
| 405 | 406 |
| 406 if (!clockless_playback_) { | 407 if (!clockless_playback_) { |
| 407 audio_sink_ = new NullAudioSink(message_loop_.task_runner()); | 408 audio_sink_ = new NullAudioSink(main_thread_task_runner_); |
| 408 } else { | 409 } else { |
| 409 clockless_audio_sink_ = new ClocklessAudioSink(OutputDeviceInfo( | 410 clockless_audio_sink_ = new ClocklessAudioSink(OutputDeviceInfo( |
| 410 "", OUTPUT_DEVICE_STATUS_OK, | 411 "", OUTPUT_DEVICE_STATUS_OK, |
| 411 // Don't allow the audio renderer to resample buffers if hashing is | 412 // Don't allow the audio renderer to resample buffers if hashing is |
| 412 // enabled: | 413 // enabled: |
| 413 hashing_enabled_ | 414 hashing_enabled_ |
| 414 ? AudioParameters() | 415 ? AudioParameters() |
| 415 : AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, | 416 : AudioParameters(AudioParameters::AUDIO_PCM_LOW_LATENCY, |
| 416 CHANNEL_LAYOUT_STEREO, 44100, 16, 512))); | 417 CHANNEL_LAYOUT_STEREO, 44100, 16, 512))); |
| 417 } | 418 } |
| 418 | 419 |
| 419 std::unique_ptr<AudioRenderer> audio_renderer(new AudioRendererImpl( | 420 std::unique_ptr<AudioRenderer> audio_renderer(new AudioRendererImpl( |
| 420 message_loop_.task_runner(), | 421 main_thread_task_runner_, |
| 421 (clockless_playback_) | 422 (clockless_playback_) |
| 422 ? static_cast<AudioRendererSink*>(clockless_audio_sink_.get()) | 423 ? static_cast<AudioRendererSink*>(clockless_audio_sink_.get()) |
| 423 : audio_sink_.get(), | 424 : audio_sink_.get(), |
| 424 base::Bind(&CreateAudioDecodersForTest, &media_log_, | 425 base::Bind(&CreateAudioDecodersForTest, &media_log_, |
| 425 message_loop_.task_runner(), prepend_audio_decoders_cb), | 426 main_thread_task_runner_, prepend_audio_decoders_cb), |
| 426 &media_log_)); | 427 &media_log_)); |
| 427 if (hashing_enabled_) { | 428 if (hashing_enabled_) { |
| 428 if (clockless_playback_) | 429 if (clockless_playback_) |
| 429 clockless_audio_sink_->StartAudioHashForTesting(); | 430 clockless_audio_sink_->StartAudioHashForTesting(); |
| 430 else | 431 else |
| 431 audio_sink_->StartAudioHashForTesting(); | 432 audio_sink_->StartAudioHashForTesting(); |
| 432 } | 433 } |
| 433 | 434 |
| 434 std::unique_ptr<RendererImpl> renderer_impl( | 435 std::unique_ptr<RendererImpl> renderer_impl( |
| 435 new RendererImpl(message_loop_.task_runner(), std::move(audio_renderer), | 436 new RendererImpl(main_thread_task_runner_, std::move(audio_renderer), |
| 436 std::move(video_renderer))); | 437 std::move(video_renderer))); |
| 437 | 438 |
| 438 // Prevent non-deterministic buffering state callbacks from firing (e.g., slow | 439 // Prevent non-deterministic buffering state callbacks from firing (e.g., slow |
| 439 // machine, valgrind). | 440 // machine, valgrind). |
| 440 renderer_impl->DisableUnderflowForTesting(); | 441 renderer_impl->DisableUnderflowForTesting(); |
| 441 | 442 |
| 442 if (clockless_playback_) | 443 if (clockless_playback_) |
| 443 renderer_impl->EnableClocklessVideoPlaybackForTesting(); | 444 renderer_impl->EnableClocklessVideoPlaybackForTesting(); |
| 444 | 445 |
| 445 return std::move(renderer_impl); | 446 return std::move(renderer_impl); |
| (...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 561 base::RunLoop().Run(); | 562 base::RunLoop().Run(); |
| 562 return pipeline_status_; | 563 return pipeline_status_; |
| 563 } | 564 } |
| 564 | 565 |
| 565 base::TimeTicks DummyTickClock::NowTicks() { | 566 base::TimeTicks DummyTickClock::NowTicks() { |
| 566 now_ += base::TimeDelta::FromSeconds(60); | 567 now_ += base::TimeDelta::FromSeconds(60); |
| 567 return now_; | 568 return now_; |
| 568 } | 569 } |
| 569 | 570 |
| 570 } // namespace media | 571 } // namespace media |
| OLD | NEW |