| Index: media/filters/pipeline_integration_test_base.cc
|
| diff --git a/media/filters/pipeline_integration_test_base.cc b/media/filters/pipeline_integration_test_base.cc
|
| index 5647eb1933de202139ce57cb1cb2f493dc74cbba..8a2f964fafa1148923af109260a70d2471c97e07 100644
|
| --- a/media/filters/pipeline_integration_test_base.cc
|
| +++ b/media/filters/pipeline_integration_test_base.cc
|
| @@ -31,10 +31,9 @@ const char kNullVideoHash[] = "d41d8cd98f00b204e9800998ecf8427e";
|
| const char kNullAudioHash[] = "0.00,0.00,0.00,0.00,0.00,0.00,";
|
|
|
| PipelineIntegrationTestBase::PipelineIntegrationTestBase()
|
| - : hashing_enabled_(false),
|
| + : message_loop_(NULL),
|
| + hashing_enabled_(false),
|
| clockless_playback_(false),
|
| - pipeline_(
|
| - new Pipeline(message_loop_.message_loop_proxy(), new MediaLog())),
|
| ended_(false),
|
| pipeline_status_(PIPELINE_OK),
|
| last_video_frame_format_(VideoFrame::UNKNOWN),
|
| @@ -43,10 +42,12 @@ PipelineIntegrationTestBase::PipelineIntegrationTestBase()
|
| }
|
|
|
| PipelineIntegrationTestBase::~PipelineIntegrationTestBase() {
|
| - if (!pipeline_->IsRunning())
|
| - return;
|
| + DCHECK(!pipeline_->IsRunning());
|
| +}
|
|
|
| - Stop();
|
| +void PipelineIntegrationTestBase::Initialize(base::MessageLoop* message_loop) {
|
| + message_loop_ = message_loop;
|
| + pipeline_.reset(new Pipeline(message_loop_->task_runner(), new MediaLog()));
|
| }
|
|
|
| void PipelineIntegrationTestBase::OnSeeked(base::TimeDelta seek_time,
|
| @@ -58,7 +59,7 @@ void PipelineIntegrationTestBase::OnSeeked(base::TimeDelta seek_time,
|
| void PipelineIntegrationTestBase::OnStatusCallback(
|
| PipelineStatus status) {
|
| pipeline_status_ = status;
|
| - message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
|
| + message_loop_->PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
|
| }
|
|
|
| void PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB(
|
| @@ -73,13 +74,13 @@ void PipelineIntegrationTestBase::OnEnded() {
|
| DCHECK(!ended_);
|
| ended_ = true;
|
| pipeline_status_ = PIPELINE_OK;
|
| - message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
|
| + message_loop_->PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
|
| }
|
|
|
| bool PipelineIntegrationTestBase::WaitUntilOnEnded() {
|
| if (ended_)
|
| return (pipeline_status_ == PIPELINE_OK);
|
| - message_loop_.Run();
|
| + message_loop_->Run();
|
| EXPECT_TRUE(ended_);
|
| return ended_ && (pipeline_status_ == PIPELINE_OK);
|
| }
|
| @@ -87,14 +88,14 @@ bool PipelineIntegrationTestBase::WaitUntilOnEnded() {
|
| PipelineStatus PipelineIntegrationTestBase::WaitUntilEndedOrError() {
|
| if (ended_ || pipeline_status_ != PIPELINE_OK)
|
| return pipeline_status_;
|
| - message_loop_.Run();
|
| + message_loop_->Run();
|
| return pipeline_status_;
|
| }
|
|
|
| void PipelineIntegrationTestBase::OnError(PipelineStatus status) {
|
| DCHECK_NE(status, PIPELINE_OK);
|
| pipeline_status_ = status;
|
| - message_loop_.PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
|
| + message_loop_->PostTask(FROM_HERE, base::MessageLoop::QuitClosure());
|
| }
|
|
|
| PipelineStatus PipelineIntegrationTestBase::Start(const std::string& filename) {
|
| @@ -131,7 +132,7 @@ PipelineStatus PipelineIntegrationTestBase::Start(const std::string& filename,
|
| base::Unretained(this)),
|
| base::Closure(), base::Bind(&PipelineIntegrationTestBase::OnAddTextTrack,
|
| base::Unretained(this)));
|
| - message_loop_.Run();
|
| + message_loop_->Run();
|
| return pipeline_status_;
|
| }
|
|
|
| @@ -154,28 +155,28 @@ bool PipelineIntegrationTestBase::Seek(base::TimeDelta seek_time) {
|
| ended_ = false;
|
|
|
| EXPECT_CALL(*this, OnBufferingStateChanged(BUFFERING_HAVE_ENOUGH))
|
| - .WillOnce(InvokeWithoutArgs(&message_loop_, &base::MessageLoop::QuitNow));
|
| + .WillOnce(InvokeWithoutArgs(message_loop_, &base::MessageLoop::QuitNow));
|
| pipeline_->Seek(seek_time, base::Bind(&PipelineIntegrationTestBase::OnSeeked,
|
| base::Unretained(this), seek_time));
|
| - message_loop_.Run();
|
| + message_loop_->Run();
|
| return (pipeline_status_ == PIPELINE_OK);
|
| }
|
|
|
| void PipelineIntegrationTestBase::Stop() {
|
| DCHECK(pipeline_->IsRunning());
|
| pipeline_->Stop(base::MessageLoop::QuitClosure());
|
| - message_loop_.Run();
|
| + message_loop_->Run();
|
| }
|
|
|
| void PipelineIntegrationTestBase::QuitAfterCurrentTimeTask(
|
| const base::TimeDelta& quit_time) {
|
| if (pipeline_->GetMediaTime() >= quit_time ||
|
| pipeline_status_ != PIPELINE_OK) {
|
| - message_loop_.Quit();
|
| + message_loop_->Quit();
|
| return;
|
| }
|
|
|
| - message_loop_.PostDelayedTask(
|
| + message_loop_->PostDelayedTask(
|
| FROM_HERE,
|
| base::Bind(&PipelineIntegrationTestBase::QuitAfterCurrentTimeTask,
|
| base::Unretained(this), quit_time),
|
| @@ -188,13 +189,13 @@ bool PipelineIntegrationTestBase::WaitUntilCurrentTimeIsAfter(
|
| DCHECK_GT(pipeline_->GetPlaybackRate(), 0);
|
| DCHECK(wait_time <= pipeline_->GetMediaDuration());
|
|
|
| - message_loop_.PostDelayedTask(
|
| + message_loop_->PostDelayedTask(
|
| FROM_HERE,
|
| base::Bind(&PipelineIntegrationTestBase::QuitAfterCurrentTimeTask,
|
| base::Unretained(this),
|
| wait_time),
|
| base::TimeDelta::FromMilliseconds(10));
|
| - message_loop_.Run();
|
| + message_loop_->Run();
|
| return (pipeline_status_ == PIPELINE_OK);
|
| }
|
|
|
| @@ -209,7 +210,7 @@ void PipelineIntegrationTestBase::CreateDemuxer(const std::string& filename) {
|
| base::Bind(&PipelineIntegrationTestBase::DemuxerEncryptedMediaInitDataCB,
|
| base::Unretained(this));
|
| demuxer_ = scoped_ptr<Demuxer>(
|
| - new FFmpegDemuxer(message_loop_.message_loop_proxy(), data_source_.get(),
|
| + new FFmpegDemuxer(message_loop_->message_loop_proxy(), data_source_.get(),
|
| encrypted_media_init_data_cb, new MediaLog()));
|
| }
|
|
|
| @@ -217,27 +218,27 @@ scoped_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() {
|
| ScopedVector<VideoDecoder> video_decoders;
|
| #if !defined(MEDIA_DISABLE_LIBVPX)
|
| video_decoders.push_back(
|
| - new VpxVideoDecoder(message_loop_.message_loop_proxy()));
|
| + new VpxVideoDecoder(message_loop_->message_loop_proxy()));
|
| #endif // !defined(MEDIA_DISABLE_LIBVPX)
|
| video_decoders.push_back(
|
| - new FFmpegVideoDecoder(message_loop_.message_loop_proxy()));
|
| + new FFmpegVideoDecoder(message_loop_->message_loop_proxy()));
|
|
|
| // Disable frame dropping if hashing is enabled.
|
| scoped_ptr<VideoRenderer> video_renderer(
|
| - new VideoRendererImpl(message_loop_.message_loop_proxy(),
|
| + new VideoRendererImpl(message_loop_->message_loop_proxy(),
|
| video_decoders.Pass(), false, new MediaLog()));
|
|
|
| if (!clockless_playback_) {
|
| - audio_sink_ = new NullAudioSink(message_loop_.message_loop_proxy());
|
| + audio_sink_ = new NullAudioSink(message_loop_->message_loop_proxy());
|
| } else {
|
| clockless_audio_sink_ = new ClocklessAudioSink();
|
| }
|
|
|
| ScopedVector<AudioDecoder> audio_decoders;
|
| audio_decoders.push_back(
|
| - new FFmpegAudioDecoder(message_loop_.message_loop_proxy(), LogCB()));
|
| + new FFmpegAudioDecoder(message_loop_->message_loop_proxy(), LogCB()));
|
| audio_decoders.push_back(
|
| - new OpusAudioDecoder(message_loop_.message_loop_proxy()));
|
| + new OpusAudioDecoder(message_loop_->message_loop_proxy()));
|
|
|
| AudioParameters out_params(AudioParameters::AUDIO_PCM_LOW_LATENCY,
|
| CHANNEL_LAYOUT_STEREO,
|
| @@ -247,7 +248,7 @@ scoped_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() {
|
| hardware_config_.UpdateOutputConfig(out_params);
|
|
|
| scoped_ptr<AudioRenderer> audio_renderer(new AudioRendererImpl(
|
| - message_loop_.message_loop_proxy(),
|
| + message_loop_->message_loop_proxy(),
|
| (clockless_playback_)
|
| ? static_cast<AudioRendererSink*>(clockless_audio_sink_.get())
|
| : audio_sink_.get(),
|
| @@ -256,7 +257,7 @@ scoped_ptr<Renderer> PipelineIntegrationTestBase::CreateRenderer() {
|
| audio_sink_->StartAudioHashForTesting();
|
|
|
| scoped_ptr<RendererImpl> renderer_impl(
|
| - new RendererImpl(message_loop_.message_loop_proxy(),
|
| + new RendererImpl(message_loop_->message_loop_proxy(),
|
| audio_renderer.Pass(),
|
| video_renderer.Pass()));
|
|
|
|
|