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

Side by Side Diff: chromecast/media/cma/filters/cma_renderer.cc

Issue 1142513004: Chromecast: MessageLoopProxy cleanup --> SingleThreadTaskRunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 5 years, 7 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
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "chromecast/media/cma/filters/cma_renderer.h" 5 #include "chromecast/media/cma/filters/cma_renderer.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/location.h" 9 #include "base/location.h"
10 #include "base/message_loop/message_loop_proxy.h" 10 #include "base/single_thread_task_runner.h"
11 #include "base/thread_task_runner_handle.h"
11 #include "chromecast/media/cma/base/balanced_media_task_runner_factory.h" 12 #include "chromecast/media/cma/base/balanced_media_task_runner_factory.h"
12 #include "chromecast/media/cma/base/cma_logging.h" 13 #include "chromecast/media/cma/base/cma_logging.h"
13 #include "chromecast/media/cma/filters/demuxer_stream_adapter.h" 14 #include "chromecast/media/cma/filters/demuxer_stream_adapter.h"
14 #include "chromecast/media/cma/pipeline/audio_pipeline.h" 15 #include "chromecast/media/cma/pipeline/audio_pipeline.h"
15 #include "chromecast/media/cma/pipeline/av_pipeline_client.h" 16 #include "chromecast/media/cma/pipeline/av_pipeline_client.h"
16 #include "chromecast/media/cma/pipeline/media_pipeline.h" 17 #include "chromecast/media/cma/pipeline/media_pipeline.h"
17 #include "chromecast/media/cma/pipeline/media_pipeline_client.h" 18 #include "chromecast/media/cma/pipeline/media_pipeline_client.h"
18 #include "chromecast/media/cma/pipeline/video_pipeline.h" 19 #include "chromecast/media/cma/pipeline/video_pipeline.h"
19 #include "chromecast/media/cma/pipeline/video_pipeline_client.h" 20 #include "chromecast/media/cma/pipeline/video_pipeline_client.h"
20 #include "media/base/bind_to_current_loop.h" 21 #include "media/base/bind_to_current_loop.h"
(...skipping 225 matching lines...) Expand 10 before | Expand all | Expand 10 after
246 // Receive events from the audio pipeline. 247 // Receive events from the audio pipeline.
247 AvPipelineClient av_pipeline_client; 248 AvPipelineClient av_pipeline_client;
248 av_pipeline_client.eos_cb = ::media::BindToCurrentLoop( 249 av_pipeline_client.eos_cb = ::media::BindToCurrentLoop(
249 base::Bind(&CmaRenderer::OnEosReached, weak_this_, true)); 250 base::Bind(&CmaRenderer::OnEosReached, weak_this_, true));
250 av_pipeline_client.playback_error_cb = ::media::BindToCurrentLoop( 251 av_pipeline_client.playback_error_cb = ::media::BindToCurrentLoop(
251 base::Bind(&CmaRenderer::OnError, weak_this_)); 252 base::Bind(&CmaRenderer::OnError, weak_this_));
252 av_pipeline_client.statistics_cb = ::media::BindToCurrentLoop( 253 av_pipeline_client.statistics_cb = ::media::BindToCurrentLoop(
253 base::Bind(&CmaRenderer::OnStatisticsUpdated, weak_this_)); 254 base::Bind(&CmaRenderer::OnStatisticsUpdated, weak_this_));
254 audio_pipeline_->SetClient(av_pipeline_client); 255 audio_pipeline_->SetClient(av_pipeline_client);
255 256
256 scoped_ptr<CodedFrameProvider> frame_provider( 257 scoped_ptr<CodedFrameProvider> frame_provider(new DemuxerStreamAdapter(
257 new DemuxerStreamAdapter( 258 base::ThreadTaskRunnerHandle::Get(), media_task_runner_factory_, stream));
258 base::MessageLoopProxy::current(),
259 media_task_runner_factory_,
260 stream));
261 259
262 const ::media::AudioDecoderConfig& config = stream->audio_decoder_config(); 260 const ::media::AudioDecoderConfig& config = stream->audio_decoder_config();
263 if (config.codec() == ::media::kCodecAAC) 261 if (config.codec() == ::media::kCodecAAC)
264 stream->EnableBitstreamConverter(); 262 stream->EnableBitstreamConverter();
265 263
266 media_pipeline_->InitializeAudio( 264 media_pipeline_->InitializeAudio(
267 config, frame_provider.Pass(), audio_initialization_done_cb); 265 config, frame_provider.Pass(), audio_initialization_done_cb);
268 } 266 }
269 267
270 void CmaRenderer::OnAudioPipelineInitializeDone( 268 void CmaRenderer::OnAudioPipelineInitializeDone(
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
307 client.av_pipeline_client.eos_cb = ::media::BindToCurrentLoop( 305 client.av_pipeline_client.eos_cb = ::media::BindToCurrentLoop(
308 base::Bind(&CmaRenderer::OnEosReached, weak_this_, false)); 306 base::Bind(&CmaRenderer::OnEosReached, weak_this_, false));
309 client.av_pipeline_client.playback_error_cb = ::media::BindToCurrentLoop( 307 client.av_pipeline_client.playback_error_cb = ::media::BindToCurrentLoop(
310 base::Bind(&CmaRenderer::OnError, weak_this_)); 308 base::Bind(&CmaRenderer::OnError, weak_this_));
311 client.av_pipeline_client.statistics_cb = ::media::BindToCurrentLoop( 309 client.av_pipeline_client.statistics_cb = ::media::BindToCurrentLoop(
312 base::Bind(&CmaRenderer::OnStatisticsUpdated, weak_this_)); 310 base::Bind(&CmaRenderer::OnStatisticsUpdated, weak_this_));
313 client.natural_size_changed_cb = ::media::BindToCurrentLoop( 311 client.natural_size_changed_cb = ::media::BindToCurrentLoop(
314 base::Bind(&CmaRenderer::OnNaturalSizeChanged, weak_this_)); 312 base::Bind(&CmaRenderer::OnNaturalSizeChanged, weak_this_));
315 video_pipeline_->SetClient(client); 313 video_pipeline_->SetClient(client);
316 314
317 scoped_ptr<CodedFrameProvider> frame_provider( 315 scoped_ptr<CodedFrameProvider> frame_provider(new DemuxerStreamAdapter(
318 new DemuxerStreamAdapter( 316 base::ThreadTaskRunnerHandle::Get(), media_task_runner_factory_, stream));
319 base::MessageLoopProxy::current(),
320 media_task_runner_factory_,
321 stream));
322 317
323 const ::media::VideoDecoderConfig& config = stream->video_decoder_config(); 318 const ::media::VideoDecoderConfig& config = stream->video_decoder_config();
324 if (config.codec() == ::media::kCodecH264) 319 if (config.codec() == ::media::kCodecH264)
325 stream->EnableBitstreamConverter(); 320 stream->EnableBitstreamConverter();
326 321
327 initial_natural_size_ = config.natural_size(); 322 initial_natural_size_ = config.natural_size();
328 323
329 media_pipeline_->InitializeVideo( 324 media_pipeline_->InitializeVideo(
330 config, 325 config,
331 frame_provider.Pass(), 326 frame_provider.Pass(),
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
463 is_pending_transition_ = true; 458 is_pending_transition_ = true;
464 } 459 }
465 460
466 void CmaRenderer::CompleteStateTransition(State new_state) { 461 void CmaRenderer::CompleteStateTransition(State new_state) {
467 state_ = new_state; 462 state_ = new_state;
468 is_pending_transition_ = false; 463 is_pending_transition_ = false;
469 } 464 }
470 465
471 } // namespace media 466 } // namespace media
472 } // namespace chromecast 467 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/media/cma/filters/cma_renderer.h ('k') | chromecast/media/cma/filters/demuxer_stream_adapter_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698