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/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
(...skipping 21 matching lines...) Expand all Loading... |
32 #include "third_party/WebKit/public/platform/WebURL.h" | 32 #include "third_party/WebKit/public/platform/WebURL.h" |
33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" | 33 #include "third_party/WebKit/Source/WebKit/chromium/public/WebDocument.h" |
34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 34 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
35 | 35 |
36 #if defined(USE_OPENSSL) | 36 #if defined(USE_OPENSSL) |
37 #include "third_party/libjingle/source/talk/base/ssladapter.h" | 37 #include "third_party/libjingle/source/talk/base/ssladapter.h" |
38 #else | 38 #else |
39 #include "net/socket/nss_ssl_util.h" | 39 #include "net/socket/nss_ssl_util.h" |
40 #endif | 40 #endif |
41 | 41 |
| 42 #if defined(GOOGLE_TV) |
| 43 #include "content/renderer/media/rtc_video_decoder_factory_tv.h" |
| 44 #endif |
| 45 |
42 namespace content { | 46 namespace content { |
43 | 47 |
44 // The constraint key for the PeerConnection constructor for enabling diagnostic | 48 // The constraint key for the PeerConnection constructor for enabling diagnostic |
45 // WebRTC logging. It's a Google specific key, hence the "goog" prefix. | 49 // WebRTC logging. It's a Google specific key, hence the "goog" prefix. |
46 const char kWebRtcLoggingConstraint[] = "googLog"; | 50 const char kWebRtcLoggingConstraint[] = "googLog"; |
47 | 51 |
48 // Constant constraint keys which disables all audio constraints. | 52 // Constant constraint keys which disables all audio constraints. |
49 // Only used in combination with WebAudio sources. | 53 // Only used in combination with WebAudio sources. |
50 struct { | 54 struct { |
51 const char* key; | 55 const char* key; |
(...skipping 153 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 bool live_; | 209 bool live_; |
206 typedef std::vector<scoped_refptr<webrtc::MediaSourceInterface> > | 210 typedef std::vector<scoped_refptr<webrtc::MediaSourceInterface> > |
207 ObservedSources; | 211 ObservedSources; |
208 ObservedSources sources_; | 212 ObservedSources sources_; |
209 }; | 213 }; |
210 | 214 |
211 MediaStreamDependencyFactory::MediaStreamDependencyFactory( | 215 MediaStreamDependencyFactory::MediaStreamDependencyFactory( |
212 VideoCaptureImplManager* vc_manager, | 216 VideoCaptureImplManager* vc_manager, |
213 P2PSocketDispatcher* p2p_socket_dispatcher) | 217 P2PSocketDispatcher* p2p_socket_dispatcher) |
214 : network_manager_(NULL), | 218 : network_manager_(NULL), |
| 219 #if defined(GOOGLE_TV) |
| 220 decoder_factory_tv_(NULL), |
| 221 #endif |
215 vc_manager_(vc_manager), | 222 vc_manager_(vc_manager), |
216 p2p_socket_dispatcher_(p2p_socket_dispatcher), | 223 p2p_socket_dispatcher_(p2p_socket_dispatcher), |
217 signaling_thread_(NULL), | 224 signaling_thread_(NULL), |
218 worker_thread_(NULL), | 225 worker_thread_(NULL), |
219 chrome_worker_thread_("Chrome_libJingle_WorkerThread") { | 226 chrome_worker_thread_("Chrome_libJingle_WorkerThread") { |
220 } | 227 } |
221 | 228 |
222 MediaStreamDependencyFactory::~MediaStreamDependencyFactory() { | 229 MediaStreamDependencyFactory::~MediaStreamDependencyFactory() { |
223 CleanupPeerConnectionFactory(); | 230 CleanupPeerConnectionFactory(); |
224 } | 231 } |
(...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
470 return type == WebKit::WebMediaStreamSource::TypeAudio ? | 477 return type == WebKit::WebMediaStreamSource::TypeAudio ? |
471 native_stream->RemoveTrack(native_stream->FindAudioTrack(track_id)) : | 478 native_stream->RemoveTrack(native_stream->FindAudioTrack(track_id)) : |
472 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id)); | 479 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id)); |
473 } | 480 } |
474 | 481 |
475 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { | 482 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { |
476 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; | 483 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; |
477 if (!pc_factory_.get()) { | 484 if (!pc_factory_.get()) { |
478 DCHECK(!audio_device_.get()); | 485 DCHECK(!audio_device_.get()); |
479 audio_device_ = new WebRtcAudioDeviceImpl(); | 486 audio_device_ = new WebRtcAudioDeviceImpl(); |
| 487 |
| 488 cricket::WebRtcVideoDecoderFactory* decoder_factory = NULL; |
| 489 #if defined(GOOGLE_TV) |
| 490 // PeerConnectionFactory will hold the ownership of this |
| 491 // VideoDecoderFactory. |
| 492 decoder_factory = decoder_factory_tv_ = new RTCVideoDecoderFactoryTv; |
| 493 #endif |
| 494 |
480 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( | 495 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( |
481 webrtc::CreatePeerConnectionFactory(worker_thread_, | 496 webrtc::CreatePeerConnectionFactory(worker_thread_, |
482 signaling_thread_, | 497 signaling_thread_, |
483 audio_device_.get(), | 498 audio_device_.get(), |
484 NULL, | 499 NULL, |
485 NULL)); | 500 decoder_factory)); |
486 if (factory.get()) | 501 if (factory.get()) |
487 pc_factory_ = factory; | 502 pc_factory_ = factory; |
488 else | 503 else |
489 audio_device_ = NULL; | 504 audio_device_ = NULL; |
490 } | 505 } |
491 return pc_factory_.get() != NULL; | 506 return pc_factory_.get() != NULL; |
492 } | 507 } |
493 | 508 |
494 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { | 509 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { |
495 return pc_factory_.get() != NULL; | 510 return pc_factory_.get() != NULL; |
(...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
782 // processed before returning. We wait for the above task to finish before | 797 // processed before returning. We wait for the above task to finish before |
783 // letting the the function continue to avoid any potential race issues. | 798 // letting the the function continue to avoid any potential race issues. |
784 chrome_worker_thread_.Stop(); | 799 chrome_worker_thread_.Stop(); |
785 } else { | 800 } else { |
786 NOTREACHED() << "Worker thread not running."; | 801 NOTREACHED() << "Worker thread not running."; |
787 } | 802 } |
788 } | 803 } |
789 } | 804 } |
790 | 805 |
791 } // namespace content | 806 } // namespace content |
OLD | NEW |