Chromium Code Reviews| 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/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| 11 #include "base/synchronization/waitable_event.h" | 11 #include "base/synchronization/waitable_event.h" |
| 12 #include "content/public/common/content_switches.h" | 12 #include "content/public/common/content_switches.h" |
| 13 #include "content/renderer/media/media_stream_source_extra_data.h" | 13 #include "content/renderer/media/media_stream_source_extra_data.h" |
| 14 #include "content/renderer/media/rtc_encoding_video_capturer_factory.h" | |
| 14 #include "content/renderer/media/rtc_media_constraints.h" | 15 #include "content/renderer/media/rtc_media_constraints.h" |
| 15 #include "content/renderer/media/rtc_peer_connection_handler.h" | 16 #include "content/renderer/media/rtc_peer_connection_handler.h" |
| 16 #include "content/renderer/media/rtc_video_capturer.h" | 17 #include "content/renderer/media/rtc_video_capturer.h" |
| 17 #include "content/renderer/media/video_capture_impl_manager.h" | 18 #include "content/renderer/media/video_capture_impl_manager.h" |
| 18 #include "content/renderer/media/webaudio_capturer_source.h" | 19 #include "content/renderer/media/webaudio_capturer_source.h" |
| 19 #include "content/renderer/media/webrtc_audio_device_impl.h" | 20 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 20 #include "content/renderer/media/webrtc_local_audio_track.h" | 21 #include "content/renderer/media/webrtc_local_audio_track.h" |
| 21 #include "content/renderer/media/webrtc_logging_initializer.h" | 22 #include "content/renderer/media/webrtc_logging_initializer.h" |
| 22 #include "content/renderer/media/webrtc_uma_histograms.h" | 23 #include "content/renderer/media/webrtc_uma_histograms.h" |
| 23 #include "content/renderer/p2p/ipc_network_manager.h" | 24 #include "content/renderer/p2p/ipc_network_manager.h" |
| (...skipping 454 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 478 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id)); | 479 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id)); |
| 479 } | 480 } |
| 480 | 481 |
| 481 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { | 482 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { |
| 482 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; | 483 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; |
| 483 if (!pc_factory_.get()) { | 484 if (!pc_factory_.get()) { |
| 484 DCHECK(!audio_device_.get()); | 485 DCHECK(!audio_device_.get()); |
| 485 audio_device_ = new WebRtcAudioDeviceImpl(); | 486 audio_device_ = new WebRtcAudioDeviceImpl(); |
| 486 | 487 |
| 487 cricket::WebRtcVideoDecoderFactory* decoder_factory = NULL; | 488 cricket::WebRtcVideoDecoderFactory* decoder_factory = NULL; |
| 489 cricket::WebRtcVideoEncoderFactory* encoder_factory = NULL; | |
| 490 | |
| 488 #if defined(GOOGLE_TV) | 491 #if defined(GOOGLE_TV) |
| 489 // PeerConnectionFactory will hold the ownership of this | 492 // PeerConnectionFactory will hold the ownership of this |
| 490 // VideoDecoderFactory. | 493 // VideoDecoderFactory. |
| 491 decoder_factory = decoder_factory_tv_ = new RTCVideoDecoderFactoryTv; | 494 decoder_factory = decoder_factory_tv_ = new RTCVideoDecoderFactoryTv; |
| 492 #endif | 495 #endif |
| 493 | 496 |
| 497 // PeerConnectionFactory owns the encoder factory. Pass a weak pointer of | |
| 498 // encoder factory to |vc_manager_| because the manager outlives it. | |
| 499 RtcEncodingVideoCapturerFactory* rtc_encoding_capturer_factory = | |
|
Ami GONE FROM CHROMIUM
2013/06/13 22:56:58
Needs to be flag-protected.
hshi1
2013/06/13 23:33:40
Do you still think we need a runtime switch (is #i
| |
| 500 new RtcEncodingVideoCapturerFactory(); | |
| 501 if (rtc_encoding_capturer_factory) { | |
|
Ami GONE FROM CHROMIUM
2013/06/13 22:56:58
this can never fail
hshi1
2013/06/13 23:33:40
Done.
| |
| 502 encoder_factory = rtc_encoding_capturer_factory; | |
| 503 vc_manager_->set_encoding_capturer_factory( | |
| 504 rtc_encoding_capturer_factory->AsWeakPtr()); | |
| 505 } | |
| 506 | |
| 494 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( | 507 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( |
| 495 webrtc::CreatePeerConnectionFactory(worker_thread_, | 508 webrtc::CreatePeerConnectionFactory(worker_thread_, |
| 496 signaling_thread_, | 509 signaling_thread_, |
| 497 audio_device_.get(), | 510 audio_device_.get(), |
| 498 NULL, | 511 encoder_factory, |
| 499 decoder_factory)); | 512 decoder_factory)); |
| 500 if (factory.get()) | 513 if (factory.get()) |
| 501 pc_factory_ = factory; | 514 pc_factory_ = factory; |
| 502 else | 515 else |
| 503 audio_device_ = NULL; | 516 audio_device_ = NULL; |
| 504 } | 517 } |
| 505 return pc_factory_.get() != NULL; | 518 return pc_factory_.get() != NULL; |
| 506 } | 519 } |
| 507 | 520 |
| 508 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { | 521 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 795 // processed before returning. We wait for the above task to finish before | 808 // processed before returning. We wait for the above task to finish before |
| 796 // letting the the function continue to avoid any potential race issues. | 809 // letting the the function continue to avoid any potential race issues. |
| 797 chrome_worker_thread_.Stop(); | 810 chrome_worker_thread_.Stop(); |
| 798 } else { | 811 } else { |
| 799 NOTREACHED() << "Worker thread not running."; | 812 NOTREACHED() << "Worker thread not running."; |
| 800 } | 813 } |
| 801 } | 814 } |
| 802 } | 815 } |
| 803 | 816 |
| 804 } // namespace content | 817 } // namespace content |
| OLD | NEW |