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" |
| (...skipping 286 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 297 &native_video_constraints).get()); | 297 &native_video_constraints).get()); |
| 298 source_observer->AddSource(source_data->video_source()); | 298 source_observer->AddSource(source_data->video_source()); |
| 299 } | 299 } |
| 300 | 300 |
| 301 // Do additional source initialization if the audio source is a valid | 301 // Do additional source initialization if the audio source is a valid |
| 302 // microphone or tab audio. | 302 // microphone or tab audio. |
| 303 RTCMediaConstraints native_audio_constraints(audio_constraints); | 303 RTCMediaConstraints native_audio_constraints(audio_constraints); |
| 304 ApplyFixedAudioConstraints(&native_audio_constraints); | 304 ApplyFixedAudioConstraints(&native_audio_constraints); |
| 305 WebKit::WebVector<WebKit::WebMediaStreamTrack> audio_tracks; | 305 WebKit::WebVector<WebKit::WebMediaStreamTrack> audio_tracks; |
| 306 web_stream->audioTracks(audio_tracks); | 306 web_stream->audioTracks(audio_tracks); |
| 307 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
| 308 if (command_line.HasSwitch(switches::kEnableWebRtcAecRecordings)) { | |
| 309 native_audio_constraints.AddOptional( | |
| 310 RTCMediaConstraints::kInternalAecDump, "true"); | |
| 311 } | |
| 312 for (size_t i = 0; i < audio_tracks.size(); ++i) { | 307 for (size_t i = 0; i < audio_tracks.size(); ++i) { |
| 313 const WebKit::WebMediaStreamSource& source = audio_tracks[i].source(); | 308 const WebKit::WebMediaStreamSource& source = audio_tracks[i].source(); |
| 314 MediaStreamSourceExtraData* source_data = | 309 MediaStreamSourceExtraData* source_data = |
| 315 static_cast<MediaStreamSourceExtraData*>(source.extraData()); | 310 static_cast<MediaStreamSourceExtraData*>(source.extraData()); |
| 316 | 311 |
| 317 // Check if the source has already been created. This happens when the same | 312 // Check if the source has already been created. This happens when the same |
| 318 // source is used in multiple MediaStreams as a result of calling | 313 // source is used in multiple MediaStreams as a result of calling |
| 319 // getUserMedia. | 314 // getUserMedia. |
| 320 if (source_data->local_audio_source()) | 315 if (source_data->local_audio_source()) |
| 321 continue; | 316 continue; |
| (...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 537 // PeerConnectionFactory will hold the ownership of this | 532 // PeerConnectionFactory will hold the ownership of this |
| 538 // VideoDecoderFactory. | 533 // VideoDecoderFactory. |
| 539 decoder_factory.reset(decoder_factory_tv_ = new RTCVideoDecoderFactoryTv()); | 534 decoder_factory.reset(decoder_factory_tv_ = new RTCVideoDecoderFactoryTv()); |
| 540 #endif | 535 #endif |
| 541 | 536 |
| 542 if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { | 537 if (!cmd_line->HasSwitch(switches::kDisableWebRtcHWEncoding)) { |
| 543 if (gpu_factories) | 538 if (gpu_factories) |
| 544 encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories)); | 539 encoder_factory.reset(new RTCVideoEncoderFactory(gpu_factories)); |
| 545 } | 540 } |
| 546 | 541 |
| 542 | |
| 547 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( | 543 scoped_refptr<webrtc::PeerConnectionFactoryInterface> factory( |
| 548 webrtc::CreatePeerConnectionFactory(worker_thread_, | 544 webrtc::CreatePeerConnectionFactory(worker_thread_, |
| 549 signaling_thread_, | 545 signaling_thread_, |
| 550 audio_device_.get(), | 546 audio_device_.get(), |
| 551 encoder_factory.release(), | 547 encoder_factory.release(), |
| 552 decoder_factory.release())); | 548 decoder_factory.release())); |
| 553 if (factory.get()) | 549 if (!factory.get()) { |
| 554 pc_factory_ = factory; | |
| 555 else | |
| 556 audio_device_ = NULL; | 550 audio_device_ = NULL; |
| 551 return false; | |
| 552 } | |
| 553 | |
| 554 pc_factory_ = factory; | |
| 555 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | |
| 556 PeerConnectionFactoryInterface::Options factory_options; | |
| 557 factory_options.enable_aec_dump = | |
| 558 cmd_line->HasSwitch(switches::kEnableWebRtcAecRecordings); | |
| 559 factory_options.disable_sctp_data_channels= | |
| 560 cmd_line->HasSwitch(switches::kDisableSCTPDataChannels); | |
| 561 pc_factory_->SetOptions(factory_options); | |
| 557 } | 562 } |
| 558 return pc_factory_.get() != NULL; | 563 return pc_factory_.get() != NULL; |
|
Ami GONE FROM CHROMIUM
2013/10/20 20:32:11
Isn't this unconditionally true now?
perkj_chrome
2013/10/21 09:56:58
yes.... I rewrote the if statement.
| |
| 559 } | 564 } |
| 560 | 565 |
| 561 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { | 566 bool MediaStreamDependencyFactory::PeerConnectionFactoryCreated() { |
| 562 return pc_factory_.get() != NULL; | 567 return pc_factory_.get() != NULL; |
| 563 } | 568 } |
| 564 | 569 |
| 565 scoped_refptr<webrtc::PeerConnectionInterface> | 570 scoped_refptr<webrtc::PeerConnectionInterface> |
| 566 MediaStreamDependencyFactory::CreatePeerConnection( | 571 MediaStreamDependencyFactory::CreatePeerConnection( |
| 567 const webrtc::PeerConnectionInterface::IceServers& ice_servers, | 572 const webrtc::PeerConnectionInterface::IceServers& ice_servers, |
| 568 const webrtc::MediaConstraintsInterface* constraints, | 573 const webrtc::MediaConstraintsInterface* constraints, |
| (...skipping 272 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 841 } | 846 } |
| 842 | 847 |
| 843 // Add the capturer to the WebRtcAudioDeviceImpl if it is a new capturer. | 848 // Add the capturer to the WebRtcAudioDeviceImpl if it is a new capturer. |
| 844 if (is_new_capturer) | 849 if (is_new_capturer) |
| 845 GetWebRtcAudioDevice()->AddAudioCapturer(capturer); | 850 GetWebRtcAudioDevice()->AddAudioCapturer(capturer); |
| 846 | 851 |
| 847 return capturer; | 852 return capturer; |
| 848 } | 853 } |
| 849 | 854 |
| 850 } // namespace content | 855 } // namespace content |
| OLD | NEW |