OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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_receiver_session.h" | 5 #include "chrome/renderer/media/cast_receiver_session.h" |
6 | 6 |
7 #include "base/synchronization/waitable_event.h" | 7 #include "base/synchronization/waitable_event.h" |
8 #include "chrome/renderer/media/cast_receiver_audio_valve.h" | 8 #include "chrome/renderer/media/cast_receiver_audio_valve.h" |
9 #include "content/public/renderer/render_thread.h" | 9 #include "content/public/renderer/render_thread.h" |
10 #include "media/base/audio_capturer_source.h" | 10 #include "media/base/audio_capturer_source.h" |
| 11 #include "media/base/bind_to_current_loop.h" |
11 #include "media/base/video_capturer_source.h" | 12 #include "media/base/video_capturer_source.h" |
12 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 13 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
13 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 14 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
14 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 15 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
15 | 16 |
16 // This is a render thread object. | 17 // This is a render thread object. |
17 class CastReceiverSession::AudioCapturerSource : | 18 class CastReceiverSession::AudioCapturerSource : |
18 public media::AudioCapturerSource { | 19 public media::AudioCapturerSource { |
19 public: | 20 public: |
20 AudioCapturerSource( | 21 AudioCapturerSource( |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 CHECK(io_message_loop_proxy_->DeleteSoon(FROM_HERE, delegate_.release())); | 65 CHECK(io_message_loop_proxy_->DeleteSoon(FROM_HERE, delegate_.release())); |
65 } | 66 } |
66 | 67 |
67 void CastReceiverSession::Start( | 68 void CastReceiverSession::Start( |
68 const media::cast::FrameReceiverConfig& audio_config, | 69 const media::cast::FrameReceiverConfig& audio_config, |
69 const media::cast::FrameReceiverConfig& video_config, | 70 const media::cast::FrameReceiverConfig& video_config, |
70 const net::IPEndPoint& local_endpoint, | 71 const net::IPEndPoint& local_endpoint, |
71 const net::IPEndPoint& remote_endpoint, | 72 const net::IPEndPoint& remote_endpoint, |
72 scoped_ptr<base::DictionaryValue> options, | 73 scoped_ptr<base::DictionaryValue> options, |
73 const media::VideoCaptureFormat& capture_format, | 74 const media::VideoCaptureFormat& capture_format, |
74 const StartCB& start_callback) { | 75 const StartCB& start_callback, |
| 76 const CastReceiverSessionDelegate::ErrorCallback& error_callback) { |
75 audio_config_ = audio_config; | 77 audio_config_ = audio_config; |
76 video_config_ = video_config; | 78 video_config_ = video_config; |
77 format_ = capture_format; | 79 format_ = capture_format; |
78 io_message_loop_proxy_->PostTask( | 80 io_message_loop_proxy_->PostTask( |
79 FROM_HERE, | 81 FROM_HERE, |
80 base::Bind(&CastReceiverSessionDelegate::Start, | 82 base::Bind(&CastReceiverSessionDelegate::Start, |
81 base::Unretained(delegate_.get()), | 83 base::Unretained(delegate_.get()), |
82 audio_config, | 84 audio_config, |
83 video_config, | 85 video_config, |
84 local_endpoint, | 86 local_endpoint, |
85 remote_endpoint, | 87 remote_endpoint, |
86 base::Passed(&options), | 88 base::Passed(&options), |
87 format_)); | 89 format_, |
| 90 media::BindToCurrentLoop(error_callback))); |
88 scoped_refptr<media::AudioCapturerSource> audio( | 91 scoped_refptr<media::AudioCapturerSource> audio( |
89 new CastReceiverSession::AudioCapturerSource(this)); | 92 new CastReceiverSession::AudioCapturerSource(this)); |
90 scoped_ptr<media::VideoCapturerSource> video( | 93 scoped_ptr<media::VideoCapturerSource> video( |
91 new CastReceiverSession::VideoCapturerSource(this)); | 94 new CastReceiverSession::VideoCapturerSource(this)); |
92 base::MessageLoop::current()->PostTask( | 95 base::MessageLoop::current()->PostTask( |
93 FROM_HERE, | 96 FROM_HERE, |
94 base::Bind(start_callback, audio, base::Passed(&video))); | 97 base::Bind(start_callback, audio, base::Passed(&video))); |
95 } | 98 } |
96 | 99 |
97 void CastReceiverSession::StartAudio( | 100 void CastReceiverSession::StartAudio( |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 } | 192 } |
190 | 193 |
191 void CastReceiverSession::AudioCapturerSource::SetVolume(double volume) { | 194 void CastReceiverSession::AudioCapturerSource::SetVolume(double volume) { |
192 // not supported | 195 // not supported |
193 } | 196 } |
194 | 197 |
195 void CastReceiverSession::AudioCapturerSource::SetAutomaticGainControl( | 198 void CastReceiverSession::AudioCapturerSource::SetAutomaticGainControl( |
196 bool enable) { | 199 bool enable) { |
197 // not supported | 200 // not supported |
198 } | 201 } |
OLD | NEW |