| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/renderer/media/media_stream_dependency_factory.h" | 5 #include "content/renderer/media/media_stream_dependency_factory.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/utf_string_conversions.h" | 10 #include "base/utf_string_conversions.h" |
| (...skipping 164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 175 const bool is_screencast = (source_data->device_info().stream_type == | 175 const bool is_screencast = (source_data->device_info().stream_type == |
| 176 content::MEDIA_TAB_VIDEO_CAPTURE); | 176 content::MEDIA_TAB_VIDEO_CAPTURE); |
| 177 scoped_refptr<webrtc::LocalVideoTrackInterface> video_track( | 177 scoped_refptr<webrtc::LocalVideoTrackInterface> video_track( |
| 178 CreateLocalVideoTrack(UTF16ToUTF8(source.id()), | 178 CreateLocalVideoTrack(UTF16ToUTF8(source.id()), |
| 179 source_data->device_info().session_id, | 179 source_data->device_info().session_id, |
| 180 is_screencast)); | 180 is_screencast)); |
| 181 native_stream->AddTrack(video_track); | 181 native_stream->AddTrack(video_track); |
| 182 video_track->set_enabled(video_components[i].isEnabled()); | 182 video_track->set_enabled(video_components[i].isEnabled()); |
| 183 } | 183 } |
| 184 | 184 |
| 185 description->setExtraData(new MediaStreamExtraData(native_stream)); | 185 description->setExtraData(new content::MediaStreamExtraData(native_stream)); |
| 186 return true; | 186 return true; |
| 187 } | 187 } |
| 188 | 188 |
| 189 bool MediaStreamDependencyFactory::CreateNativeLocalMediaStream( | 189 bool MediaStreamDependencyFactory::CreateNativeLocalMediaStream( |
| 190 WebKit::WebMediaStreamDescriptor* description, | 190 WebKit::WebMediaStreamDescriptor* description, |
| 191 const MediaStreamExtraData::StreamStopCallback& stream_stop) { | 191 const content::MediaStreamExtraData::StreamStopCallback& stream_stop) { |
| 192 if (!CreateNativeLocalMediaStream(description)) | 192 if (!CreateNativeLocalMediaStream(description)) |
| 193 return false; | 193 return false; |
| 194 | 194 |
| 195 MediaStreamExtraData* extra_data = | 195 content::MediaStreamExtraData* extra_data = |
| 196 static_cast<MediaStreamExtraData*>(description->extraData()); | 196 static_cast<content::MediaStreamExtraData*>(description->extraData()); |
| 197 extra_data->SetLocalStreamStopCallback(stream_stop); | 197 extra_data->SetLocalStreamStopCallback(stream_stop); |
| 198 return true; | 198 return true; |
| 199 } | 199 } |
| 200 | 200 |
| 201 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { | 201 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { |
| 202 if (!pc_factory_.get()) { | 202 if (!pc_factory_.get()) { |
| 203 DCHECK(!audio_device_); | 203 DCHECK(!audio_device_); |
| 204 audio_device_ = new WebRtcAudioDeviceImpl(); | 204 audio_device_ = new content::WebRtcAudioDeviceImpl(); |
| 205 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( | 205 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( |
| 206 webrtc::CreatePeerConnectionFactory(worker_thread_, | 206 webrtc::CreatePeerConnectionFactory(worker_thread_, |
| 207 signaling_thread_, | 207 signaling_thread_, |
| 208 audio_device_)); | 208 audio_device_)); |
| 209 if (factory.get()) | 209 if (factory.get()) |
| 210 pc_factory_ = factory.release(); | 210 pc_factory_ = factory.release(); |
| 211 } | 211 } |
| 212 return pc_factory_.get() != NULL; | 212 return pc_factory_.get() != NULL; |
| 213 } | 213 } |
| 214 | 214 |
| (...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 383 base::Unretained(this))); | 383 base::Unretained(this))); |
| 384 // Stopping the thread will wait until all tasks have been | 384 // Stopping the thread will wait until all tasks have been |
| 385 // processed before returning. We wait for the above task to finish before | 385 // processed before returning. We wait for the above task to finish before |
| 386 // letting the the function continue to avoid any potential race issues. | 386 // letting the the function continue to avoid any potential race issues. |
| 387 chrome_worker_thread_.Stop(); | 387 chrome_worker_thread_.Stop(); |
| 388 } else { | 388 } else { |
| 389 NOTREACHED() << "Worker thread not running."; | 389 NOTREACHED() << "Worker thread not running."; |
| 390 } | 390 } |
| 391 } | 391 } |
| 392 } | 392 } |
| OLD | NEW |