| 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 275 continue; | 275 continue; |
| 276 } | 276 } |
| 277 const bool is_screencast = | 277 const bool is_screencast = |
| 278 source_data->device_info().device.type == | 278 source_data->device_info().device.type == |
| 279 content::MEDIA_TAB_VIDEO_CAPTURE || | 279 content::MEDIA_TAB_VIDEO_CAPTURE || |
| 280 source_data->device_info().device.type == | 280 source_data->device_info().device.type == |
| 281 content::MEDIA_SCREEN_VIDEO_CAPTURE; | 281 content::MEDIA_SCREEN_VIDEO_CAPTURE; |
| 282 source_data->SetVideoSource( | 282 source_data->SetVideoSource( |
| 283 CreateLocalVideoSource(source_data->device_info().session_id, | 283 CreateLocalVideoSource(source_data->device_info().session_id, |
| 284 is_screencast, | 284 is_screencast, |
| 285 &native_video_constraints)); | 285 &native_video_constraints).get()); |
| 286 source_observer->AddSource(source_data->video_source()); | 286 source_observer->AddSource(source_data->video_source()); |
| 287 } | 287 } |
| 288 | 288 |
| 289 // Do additional source initialization if the audio source is a valid | 289 // Do additional source initialization if the audio source is a valid |
| 290 // microphone or tab audio. | 290 // microphone or tab audio. |
| 291 RTCMediaConstraints native_audio_constraints(audio_constraints); | 291 RTCMediaConstraints native_audio_constraints(audio_constraints); |
| 292 WebKit::WebVector<WebKit::WebMediaStreamTrack> audio_tracks; | 292 WebKit::WebVector<WebKit::WebMediaStreamTrack> audio_tracks; |
| 293 description->audioSources(audio_tracks); | 293 description->audioSources(audio_tracks); |
| 294 for (size_t i = 0; i < audio_tracks.size(); ++i) { | 294 for (size_t i = 0; i < audio_tracks.size(); ++i) { |
| 295 const WebKit::WebMediaStreamSource& source = audio_tracks[i].source(); | 295 const WebKit::WebMediaStreamSource& source = audio_tracks[i].source(); |
| (...skipping 17 matching lines...) Expand all Loading... |
| 313 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); | 313 const CommandLine& command_line = *CommandLine::ForCurrentProcess(); |
| 314 // TODO(grunell): Change hard coded string to | 314 // TODO(grunell): Change hard coded string to |
| 315 // RTCMediaConstraints::kInternalAecDump when libjingle has been rolled. | 315 // RTCMediaConstraints::kInternalAecDump when libjingle has been rolled. |
| 316 if (command_line.HasSwitch(switches::kEnableWebRtcAecRecordings)) { | 316 if (command_line.HasSwitch(switches::kEnableWebRtcAecRecordings)) { |
| 317 native_audio_constraints.AddOptional( | 317 native_audio_constraints.AddOptional( |
| 318 "internalAecDump", "true"); | 318 "internalAecDump", "true"); |
| 319 } | 319 } |
| 320 | 320 |
| 321 // Creates a LocalAudioSource object which holds audio options. | 321 // Creates a LocalAudioSource object which holds audio options. |
| 322 source_data->SetLocalAudioSource( | 322 source_data->SetLocalAudioSource( |
| 323 CreateLocalAudioSource(&native_audio_constraints)); | 323 CreateLocalAudioSource(&native_audio_constraints).get()); |
| 324 source_observer->AddSource(source_data->local_audio_source()); | 324 source_observer->AddSource(source_data->local_audio_source()); |
| 325 } | 325 } |
| 326 | 326 |
| 327 source_observer->StartObservering(); | 327 source_observer->StartObservering(); |
| 328 } | 328 } |
| 329 | 329 |
| 330 void MediaStreamDependencyFactory::CreateNativeLocalMediaStream( | 330 void MediaStreamDependencyFactory::CreateNativeLocalMediaStream( |
| 331 WebKit::WebMediaStream* description) { | 331 WebKit::WebMediaStream* description) { |
| 332 DVLOG(1) << "MediaStreamDependencyFactory::CreateNativeLocalMediaStream()"; | 332 DVLOG(1) << "MediaStreamDependencyFactory::CreateNativeLocalMediaStream()"; |
| 333 if (!EnsurePeerConnectionFactory()) { | 333 if (!EnsurePeerConnectionFactory()) { |
| (...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 615 MediaStreamSourceExtraData* source_data = | 615 MediaStreamSourceExtraData* source_data = |
| 616 new content::MediaStreamSourceExtraData(webaudio_capturer_source.get()); | 616 new content::MediaStreamSourceExtraData(webaudio_capturer_source.get()); |
| 617 | 617 |
| 618 // Create a LocalAudioSource object which holds audio options. | 618 // Create a LocalAudioSource object which holds audio options. |
| 619 // Use audio constraints where all values are false, i.e., disable | 619 // Use audio constraints where all values are false, i.e., disable |
| 620 // echo cancellation, automatic gain control, noise suppression and | 620 // echo cancellation, automatic gain control, noise suppression and |
| 621 // high-pass filter. SetLocalAudioSource() affects core audio parts in | 621 // high-pass filter. SetLocalAudioSource() affects core audio parts in |
| 622 // third_party/Libjingle. | 622 // third_party/Libjingle. |
| 623 WebAudioConstraints webaudio_audio_constraints_all_false; | 623 WebAudioConstraints webaudio_audio_constraints_all_false; |
| 624 source_data->SetLocalAudioSource( | 624 source_data->SetLocalAudioSource( |
| 625 CreateLocalAudioSource(&webaudio_audio_constraints_all_false)); | 625 CreateLocalAudioSource(&webaudio_audio_constraints_all_false).get()); |
| 626 source->setExtraData(source_data); | 626 source->setExtraData(source_data); |
| 627 | 627 |
| 628 // Replace the default source with WebAudio as source instead. | 628 // Replace the default source with WebAudio as source instead. |
| 629 source->addAudioConsumer(webaudio_capturer_source.get()); | 629 source->addAudioConsumer(webaudio_capturer_source.get()); |
| 630 | 630 |
| 631 return true; | 631 return true; |
| 632 } | 632 } |
| 633 | 633 |
| 634 scoped_refptr<webrtc::VideoTrackInterface> | 634 scoped_refptr<webrtc::VideoTrackInterface> |
| 635 MediaStreamDependencyFactory::CreateLocalVideoTrack( | 635 MediaStreamDependencyFactory::CreateLocalVideoTrack( |
| (...skipping 161 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 797 // 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 |
| 798 // letting the the function continue to avoid any potential race issues. | 798 // letting the the function continue to avoid any potential race issues. |
| 799 chrome_worker_thread_.Stop(); | 799 chrome_worker_thread_.Stop(); |
| 800 } else { | 800 } else { |
| 801 NOTREACHED() << "Worker thread not running."; | 801 NOTREACHED() << "Worker thread not running."; |
| 802 } | 802 } |
| 803 } | 803 } |
| 804 } | 804 } |
| 805 | 805 |
| 806 } // namespace content | 806 } // namespace content |
| OLD | NEW |