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

Side by Side Diff: chrome/renderer/media/cast_session.cc

Issue 138753004: Cast: IPC glue between cast library transport and encoders. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: added rtp statistics callbacks Created 6 years, 10 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 "chrome/renderer/media/cast_session.h" 5 #include "chrome/renderer/media/cast_session.h"
6 6
7 #include "base/message_loop/message_loop_proxy.h" 7 #include "base/message_loop/message_loop_proxy.h"
8 #include "chrome/renderer/media/cast_session_delegate.h" 8 #include "chrome/renderer/media/cast_session_delegate.h"
9 #include "content/public/renderer/render_thread.h" 9 #include "content/public/renderer/render_thread.h"
10 #include "media/base/bind_to_current_loop.h" 10 #include "media/base/bind_to_current_loop.h"
11 #include "media/base/video_frame.h" 11 #include "media/base/video_frame.h"
12 #include "media/cast/cast_config.h" 12 #include "media/cast/cast_config.h"
13 #include "media/cast/cast_sender.h" 13 #include "media/cast/cast_sender.h"
14 14
15 CastSession::CastSession() 15 CastSession::CastSession()
16 : delegate_(new CastSessionDelegate()), 16 : delegate_(new CastSessionDelegate()),
17 io_message_loop_proxy_( 17 io_message_loop_proxy_(
18 content::RenderThread::Get()->GetIOMessageLoopProxy()) { 18 content::RenderThread::Get()->GetIOMessageLoopProxy()) {
19 } 19 }
20 20
21 CastSession::~CastSession() { 21 CastSession::~CastSession() {
22 // We should always be able to delete the object on the IO thread. 22 // We should always be able to delete the object on the IO thread.
23 CHECK(io_message_loop_proxy_->DeleteSoon(FROM_HERE, delegate_.release())); 23 CHECK(io_message_loop_proxy_->DeleteSoon(FROM_HERE, delegate_.release()));
24 } 24 }
25 25
26 void CastSession::StartAudio(const media::cast::AudioSenderConfig& config, 26 void CastSession::StartAudio(const media::cast::AudioSenderConfig& config,
27 const FrameInputAvailableCallback& callback) { 27 const FrameInputAvailableCallback& callback) {
28 io_message_loop_proxy_->PostTask(FROM_HERE, 28 io_message_loop_proxy_->PostTask(
29 FROM_HERE,
29 base::Bind( 30 base::Bind(
30 &CastSessionDelegate::StartAudio, 31 &CastSessionDelegate::StartAudio,
31 base::Unretained(delegate_.get()), 32 base::Unretained(delegate_.get()),
32 config, 33 config,
33 media::BindToCurrentLoop(callback))); 34 media::BindToCurrentLoop(callback)));
34 } 35 }
35 36
36 void CastSession::StartVideo(const media::cast::VideoSenderConfig& config, 37 void CastSession::StartVideo(const media::cast::VideoSenderConfig& config,
37 const FrameInputAvailableCallback& callback) { 38 const FrameInputAvailableCallback& callback) {
38 io_message_loop_proxy_->PostTask(FROM_HERE, 39 io_message_loop_proxy_->PostTask(
40 FROM_HERE,
39 base::Bind( 41 base::Bind(
40 &CastSessionDelegate::StartVideo, 42 &CastSessionDelegate::StartVideo,
41 base::Unretained(delegate_.get()), 43 base::Unretained(delegate_.get()),
42 config, 44 config,
43 media::BindToCurrentLoop(callback))); 45 media::BindToCurrentLoop(callback)));
44 } 46 }
47
48 void CastSession::StartUDP(const net::IPEndPoint& local_endpoint,
49 const net::IPEndPoint& remote_endpoint) {
50 io_message_loop_proxy_->PostTask(
51 FROM_HERE,
52 base::Bind(
53 &CastSessionDelegate::StartUDP,
54 base::Unretained(delegate_.get()),
55 local_endpoint,
56 remote_endpoint));
57 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698