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

Side by Side Diff: chromecast/browser/media/cma_message_filter_host.cc

Issue 1168643004: Allow CastContentBrowserClient to customise media pipeline device (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Comment updates + Android exclusion Created 5 years, 6 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/browser/media/cma_message_filter_host.h" 5 #include "chromecast/browser/media/cma_message_filter_host.h"
6 6
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/lazy_instance.h" 9 #include "base/lazy_instance.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
290 290
291 VideoPlane* video_plane = CastMediaShlib::GetVideoPlane(); 291 VideoPlane* video_plane = CastMediaShlib::GetVideoPlane();
292 video_plane->SetGeometry( 292 video_plane->SetGeometry(
293 rect, 293 rect,
294 VideoPlane::COORDINATE_TYPE_GRAPHICS_PLANE, 294 VideoPlane::COORDINATE_TYPE_GRAPHICS_PLANE,
295 transform); 295 transform);
296 } 296 }
297 297
298 } // namespace 298 } // namespace
299 299
300 CmaMessageFilterHost::CmaMessageFilterHost(int render_process_id) 300 CmaMessageFilterHost::CmaMessageFilterHost(
301 int render_process_id,
302 const media::CreatePipelineDeviceCB& create_pipeline_device_cb)
301 : content::BrowserMessageFilter(CastMediaMsgStart), 303 : content::BrowserMessageFilter(CastMediaMsgStart),
302 process_id_(render_process_id), 304 process_id_(render_process_id),
305 create_pipeline_device_cb_(create_pipeline_device_cb),
303 task_runner_(CmaMessageLoop::GetTaskRunner()), 306 task_runner_(CmaMessageLoop::GetTaskRunner()),
304 weak_factory_(this) { 307 weak_factory_(this) {
305 weak_this_ = weak_factory_.GetWeakPtr(); 308 weak_this_ = weak_factory_.GetWeakPtr();
306 } 309 }
307 310
308 CmaMessageFilterHost::~CmaMessageFilterHost() { 311 CmaMessageFilterHost::~CmaMessageFilterHost() {
309 DCHECK(media_pipelines_.empty()); 312 DCHECK(media_pipelines_.empty());
310 } 313 }
311 314
312 void CmaMessageFilterHost::OnChannelClosing() { 315 void CmaMessageFilterHost::OnChannelClosing() {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
375 client.buffering_state_cb = ::media::BindToCurrentLoop(base::Bind( 378 client.buffering_state_cb = ::media::BindToCurrentLoop(base::Bind(
376 &CmaMessageFilterHost::OnBufferingNotification, weak_this_, media_id)); 379 &CmaMessageFilterHost::OnBufferingNotification, weak_this_, media_id));
377 client.error_cb = ::media::BindToCurrentLoop( 380 client.error_cb = ::media::BindToCurrentLoop(
378 base::Bind(&CmaMessageFilterHost::OnPlaybackError, 381 base::Bind(&CmaMessageFilterHost::OnPlaybackError,
379 weak_this_, media_id, media::kNoTrackId)); 382 weak_this_, media_id, media::kNoTrackId));
380 task_runner_->PostTask( 383 task_runner_->PostTask(
381 FROM_HERE, 384 FROM_HERE,
382 base::Bind(&SetMediaPipeline, 385 base::Bind(&SetMediaPipeline,
383 process_id_, media_id, media_pipeline_host.get())); 386 process_id_, media_id, media_pipeline_host.get()));
384 task_runner_->PostTask( 387 task_runner_->PostTask(
385 FROM_HERE, 388 FROM_HERE, base::Bind(&MediaPipelineHost::Initialize,
386 base::Bind(&MediaPipelineHost::Initialize, 389 base::Unretained(media_pipeline_host.get()),
387 base::Unretained(media_pipeline_host.get()), 390 load_type, client, create_pipeline_device_cb_));
388 load_type, client));
389 std::pair<MediaPipelineMap::iterator, bool> ret = 391 std::pair<MediaPipelineMap::iterator, bool> ret =
390 media_pipelines_.insert( 392 media_pipelines_.insert(
391 std::make_pair(media_id, media_pipeline_host.release())); 393 std::make_pair(media_id, media_pipeline_host.release()));
392 394
393 // Check there is no other entry with the same ID. 395 // Check there is no other entry with the same ID.
394 DCHECK(ret.second != false); 396 DCHECK(ret.second != false);
395 } 397 }
396 398
397 void CmaMessageFilterHost::DestroyMedia(int media_id) { 399 void CmaMessageFilterHost::DestroyMedia(int media_id) {
398 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 400 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
691 } 693 }
692 694
693 void CmaMessageFilterHost::OnNaturalSizeChanged( 695 void CmaMessageFilterHost::OnNaturalSizeChanged(
694 int media_id, TrackId track_id, const gfx::Size& size) { 696 int media_id, TrackId track_id, const gfx::Size& size) {
695 DCHECK_CURRENTLY_ON(content::BrowserThread::IO); 697 DCHECK_CURRENTLY_ON(content::BrowserThread::IO);
696 Send(new CmaMsg_NaturalSizeChanged(media_id, track_id, size)); 698 Send(new CmaMsg_NaturalSizeChanged(media_id, track_id, size));
697 } 699 }
698 700
699 } // namespace media 701 } // namespace media
700 } // namespace chromecast 702 } // namespace chromecast
OLDNEW
« no previous file with comments | « chromecast/browser/media/cma_message_filter_host.h ('k') | chromecast/browser/media/media_pipeline_host.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698