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/synchronization/waitable_event.h" | 10 #include "base/synchronization/waitable_event.h" |
| 10 #include "base/utf_string_conversions.h" | 11 #include "base/utf_string_conversions.h" |
| 12 #include "content/public/common/content_switches.h" | |
| 11 #include "content/renderer/media/media_stream_source_extra_data.h" | 13 #include "content/renderer/media/media_stream_source_extra_data.h" |
| 12 #include "content/renderer/media/rtc_media_constraints.h" | 14 #include "content/renderer/media/rtc_media_constraints.h" |
| 13 #include "content/renderer/media/rtc_peer_connection_handler.h" | 15 #include "content/renderer/media/rtc_peer_connection_handler.h" |
| 14 #include "content/renderer/media/rtc_video_capturer.h" | 16 #include "content/renderer/media/rtc_video_capturer.h" |
| 15 #include "content/renderer/media/video_capture_impl_manager.h" | 17 #include "content/renderer/media/video_capture_impl_manager.h" |
| 16 #include "content/renderer/media/webaudio_capturer_source.h" | 18 #include "content/renderer/media/webaudio_capturer_source.h" |
| 17 #include "content/renderer/media/webrtc_audio_device_impl.h" | 19 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 18 #include "content/renderer/media/webrtc_local_audio_track.h" | 20 #include "content/renderer/media/webrtc_local_audio_track.h" |
| 19 #include "content/renderer/media/webrtc_uma_histograms.h" | 21 #include "content/renderer/media/webrtc_uma_histograms.h" |
| 20 #include "content/renderer/p2p/ipc_network_manager.h" | 22 #include "content/renderer/p2p/ipc_network_manager.h" |
| (...skipping 428 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 449 type == WebKit::WebMediaStreamSource::TypeVideo); | 451 type == WebKit::WebMediaStreamSource::TypeVideo); |
| 450 | 452 |
| 451 std::string track_id = UTF16ToUTF8(track.id()); | 453 std::string track_id = UTF16ToUTF8(track.id()); |
| 452 return type == WebKit::WebMediaStreamSource::TypeAudio ? | 454 return type == WebKit::WebMediaStreamSource::TypeAudio ? |
| 453 native_stream->RemoveTrack(native_stream->FindAudioTrack(track_id)) : | 455 native_stream->RemoveTrack(native_stream->FindAudioTrack(track_id)) : |
| 454 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id)); | 456 native_stream->RemoveTrack(native_stream->FindVideoTrack(track_id)); |
| 455 } | 457 } |
| 456 | 458 |
| 457 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { | 459 bool MediaStreamDependencyFactory::CreatePeerConnectionFactory() { |
| 458 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; | 460 DVLOG(1) << "MediaStreamDependencyFactory::CreatePeerConnectionFactory()"; |
| 461 | |
| 459 if (!pc_factory_) { | 462 if (!pc_factory_) { |
| 460 DCHECK(!audio_device_); | 463 DCHECK(!audio_device_); |
| 461 audio_device_ = new WebRtcAudioDeviceImpl(); | 464 audio_device_ = new WebRtcAudioDeviceImpl(); |
| 465 | |
| 466 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
| 467 bool enable_aec_recording = | |
| 468 command_line.HasSwitch(switches::kEnableWebRtcAecRecordings); | |
| 469 | |
| 462 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( | 470 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( |
| 463 webrtc::CreatePeerConnectionFactory( | 471 webrtc::CreatePeerConnectionFactory( |
| 464 worker_thread_, signaling_thread_, audio_device_, NULL, NULL)); | 472 worker_thread_, signaling_thread_, audio_device_, NULL, NULL, |
| 473 enable_aec_recording)); | |
|
tommi (sloooow) - chröme
2013/05/13 14:56:23
does this depend on a new roll? if so, can you ad
Henrik Grunell
2013/05/14 08:39:06
Yes it does, added that info.
| |
| 465 if (factory) | 474 if (factory) |
| 466 pc_factory_ = factory; | 475 pc_factory_ = factory; |
| 467 else | 476 else |
| 468 audio_device_ = NULL; | 477 audio_device_ = NULL; |
| 469 } | 478 } |
| 470 return pc_factory_.get() != NULL; | 479 return pc_factory_.get() != NULL; |
| 471 } | 480 } |
| 472 | 481 |
| 473 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { | 482 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { |
| 474 return pc_factory_.get() != NULL; | 483 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 | 755 // processed before returning. We wait for the above task to finish before |
| 747 // letting the the function continue to avoid any potential race issues. | 756 // letting the the function continue to avoid any potential race issues. |
| 748 chrome_worker_thread_.Stop(); | 757 chrome_worker_thread_.Stop(); |
| 749 } else { | 758 } else { |
| 750 NOTREACHED() << "Worker thread not running."; | 759 NOTREACHED() << "Worker thread not running."; |
| 751 } | 760 } |
| 752 } | 761 } |
| 753 } | 762 } |
| 754 | 763 |
| 755 } // namespace content | 764 } // namespace content |
| OLD | NEW |