| 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 15 matching lines...) Expand all Loading... |
| 26 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc
e.h" | 26 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamSourc
e.h" |
| 27 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack
.h" | 27 #include "third_party/WebKit/Source/Platform/chromium/public/WebMediaStreamTrack
.h" |
| 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 28 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 29 | 29 |
| 30 #if defined(USE_OPENSSL) | 30 #if defined(USE_OPENSSL) |
| 31 #include "third_party/libjingle/source/talk/base/ssladapter.h" | 31 #include "third_party/libjingle/source/talk/base/ssladapter.h" |
| 32 #else | 32 #else |
| 33 #include "net/socket/nss_ssl_util.h" | 33 #include "net/socket/nss_ssl_util.h" |
| 34 #endif | 34 #endif |
| 35 | 35 |
| 36 #if defined(GOOGLE_TV) |
| 37 #include "content/renderer/media/rtc_video_decoder_factory_tv.h" |
| 38 #endif |
| 39 |
| 36 namespace content { | 40 namespace content { |
| 37 | 41 |
| 38 // Constant constraint keys which disables all audio constraints. | 42 // Constant constraint keys which disables all audio constraints. |
| 39 // Only used in combination with WebAudio sources. | 43 // Only used in combination with WebAudio sources. |
| 40 struct { | 44 struct { |
| 41 const char* key; | 45 const char* key; |
| 42 const char* value; | 46 const char* value; |
| 43 } const kWebAudioConstraints[] = { | 47 } const kWebAudioConstraints[] = { |
| 44 {webrtc::MediaConstraintsInterface::kEchoCancellation, | 48 {webrtc::MediaConstraintsInterface::kEchoCancellation, |
| 45 webrtc::MediaConstraintsInterface::kValueFalse}, | 49 webrtc::MediaConstraintsInterface::kValueFalse}, |
| (...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 195 bool live_; | 199 bool live_; |
| 196 typedef std::vector<scoped_refptr<webrtc::MediaSourceInterface> > | 200 typedef std::vector<scoped_refptr<webrtc::MediaSourceInterface> > |
| 197 ObservedSources; | 201 ObservedSources; |
| 198 ObservedSources sources_; | 202 ObservedSources sources_; |
| 199 }; | 203 }; |
| 200 | 204 |
| 201 MediaStreamDependencyFactory::MediaStreamDependencyFactory( | 205 MediaStreamDependencyFactory::MediaStreamDependencyFactory( |
| 202 VideoCaptureImplManager* vc_manager, | 206 VideoCaptureImplManager* vc_manager, |
| 203 P2PSocketDispatcher* p2p_socket_dispatcher) | 207 P2PSocketDispatcher* p2p_socket_dispatcher) |
| 204 : network_manager_(NULL), | 208 : network_manager_(NULL), |
| 209 #if defined(GOOGLE_TV) |
| 210 decoder_factory_tv_(NULL), |
| 211 #endif |
| 205 vc_manager_(vc_manager), | 212 vc_manager_(vc_manager), |
| 206 p2p_socket_dispatcher_(p2p_socket_dispatcher), | 213 p2p_socket_dispatcher_(p2p_socket_dispatcher), |
| 207 signaling_thread_(NULL), | 214 signaling_thread_(NULL), |
| 208 worker_thread_(NULL), | 215 worker_thread_(NULL), |
| 209 chrome_worker_thread_("Chrome_libJingle_WorkerThread") { | 216 chrome_worker_thread_("Chrome_libJingle_WorkerThread") { |
| 210 } | 217 } |
| 211 | 218 |
| 212 MediaStreamDependencyFactory::~MediaStreamDependencyFactory() { | 219 MediaStreamDependencyFactory::~MediaStreamDependencyFactory() { |
| 213 CleanupPeerConnectionFactory(); | 220 CleanupPeerConnectionFactory(); |
| 214 } | 221 } |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 452 return type == WebKit::WebMediaStreamSource::TypeAudio ? | 459 return type == WebKit::WebMediaStreamSource::TypeAudio ? |
| 453 native_stream->RemoveTrack(native_stream->FindAudioTrack(track_id)) : | 460 native_stream->RemoveTrack(native_stream->FindAudioTrack(track_id)) : |
| 454 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id)); | 461 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id)); |
| 455 } | 462 } |
| 456 | 463 |
| 457 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { | 464 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { |
| 458 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; | 465 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; |
| 459 if (!pc_factory_) { | 466 if (!pc_factory_) { |
| 460 DCHECK(!audio_device_); | 467 DCHECK(!audio_device_); |
| 461 audio_device_ = new WebRtcAudioDeviceImpl(); | 468 audio_device_ = new WebRtcAudioDeviceImpl(); |
| 469 |
| 470 cricket::WebRtcVideoDecoderFactory* decoder_factory = NULL; |
| 471 #if defined(GOOGLE_TV) |
| 472 // PeerConnectionFactory will hold the ownership of this |
| 473 // VideoDecoderFactory. |
| 474 decoder_factory = decoder_factory_tv_ = new RTCVideoDecoderFactoryTv; |
| 475 #endif |
| 476 |
| 462 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( | 477 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( |
| 463 webrtc::CreatePeerConnectionFactory( | 478 webrtc::CreatePeerConnectionFactory(worker_thread_, |
| 464 worker_thread_, signaling_thread_, audio_device_, NULL, NULL)); | 479 signaling_thread_, |
| 480 audio_device_, |
| 481 NULL, |
| 482 decoder_factory)); |
| 465 if (factory) | 483 if (factory) |
| 466 pc_factory_ = factory; | 484 pc_factory_ = factory; |
| 467 else | 485 else |
| 468 audio_device_ = NULL; | 486 audio_device_ = NULL; |
| 469 } | 487 } |
| 470 return pc_factory_.get() != NULL; | 488 return pc_factory_.get() != NULL; |
| 471 } | 489 } |
| 472 | 490 |
| 473 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { | 491 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { |
| 474 return pc_factory_.get() != NULL; | 492 return pc_factory_.get() != NULL; |
| (...skipping 271 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 746 // processed before returning. We wait for the above task to finish before | 764 // processed before returning. We wait for the above task to finish before |
| 747 // letting the the function continue to avoid any potential race issues. | 765 // letting the the function continue to avoid any potential race issues. |
| 748 chrome_worker_thread_.Stop(); | 766 chrome_worker_thread_.Stop(); |
| 749 } else { | 767 } else { |
| 750 NOTREACHED() << "Worker thread not running."; | 768 NOTREACHED() << "Worker thread not running."; |
| 751 } | 769 } |
| 752 } | 770 } |
| 753 } | 771 } |
| 754 | 772 |
| 755 } // namespace content | 773 } // namespace content |
| OLD | NEW |