Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/webrtc/peer_connection_dependency_factory.h" | 5 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <utility> | 9 #include <utility> |
| 10 #include <vector> | 10 #include <vector> |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 25 #include "content/public/common/content_switches.h" | 25 #include "content/public/common/content_switches.h" |
| 26 #include "content/public/common/feature_h264_with_openh264_ffmpeg.h" | 26 #include "content/public/common/feature_h264_with_openh264_ffmpeg.h" |
| 27 #include "content/public/common/features.h" | 27 #include "content/public/common/features.h" |
| 28 #include "content/public/common/renderer_preferences.h" | 28 #include "content/public/common/renderer_preferences.h" |
| 29 #include "content/public/common/webrtc_ip_handling_policy.h" | 29 #include "content/public/common/webrtc_ip_handling_policy.h" |
| 30 #include "content/public/renderer/content_renderer_client.h" | 30 #include "content/public/renderer/content_renderer_client.h" |
| 31 #include "content/renderer/media/media_stream.h" | 31 #include "content/renderer/media/media_stream.h" |
| 32 #include "content/renderer/media/media_stream_audio_processor.h" | 32 #include "content/renderer/media/media_stream_audio_processor.h" |
| 33 #include "content/renderer/media/media_stream_audio_processor_options.h" | 33 #include "content/renderer/media/media_stream_audio_processor_options.h" |
| 34 #include "content/renderer/media/media_stream_audio_source.h" | 34 #include "content/renderer/media/media_stream_audio_source.h" |
| 35 #include "content/renderer/media/media_stream_constraints_util.h" | |
| 35 #include "content/renderer/media/media_stream_video_source.h" | 36 #include "content/renderer/media/media_stream_video_source.h" |
| 36 #include "content/renderer/media/media_stream_video_track.h" | 37 #include "content/renderer/media/media_stream_video_track.h" |
| 37 #include "content/renderer/media/peer_connection_identity_store.h" | 38 #include "content/renderer/media/peer_connection_identity_store.h" |
| 38 #include "content/renderer/media/rtc_media_constraints.h" | |
| 39 #include "content/renderer/media/rtc_peer_connection_handler.h" | 39 #include "content/renderer/media/rtc_peer_connection_handler.h" |
| 40 #include "content/renderer/media/rtc_video_decoder_factory.h" | 40 #include "content/renderer/media/rtc_video_decoder_factory.h" |
| 41 #include "content/renderer/media/rtc_video_encoder_factory.h" | 41 #include "content/renderer/media/rtc_video_encoder_factory.h" |
| 42 #include "content/renderer/media/webaudio_capturer_source.h" | 42 #include "content/renderer/media/webaudio_capturer_source.h" |
| 43 #include "content/renderer/media/webrtc/media_stream_remote_audio_track.h" | 43 #include "content/renderer/media/webrtc/media_stream_remote_audio_track.h" |
| 44 #include "content/renderer/media/webrtc/stun_field_trial.h" | 44 #include "content/renderer/media/webrtc/stun_field_trial.h" |
| 45 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" | 45 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" |
| 46 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" | 46 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" |
| 47 #include "content/renderer/media/webrtc_audio_device_impl.h" | 47 #include "content/renderer/media/webrtc_audio_device_impl.h" |
| 48 #include "content/renderer/media/webrtc_local_audio_track.h" | 48 #include "content/renderer/media/webrtc_local_audio_track.h" |
| (...skipping 14 matching lines...) Expand all Loading... | |
| 63 #include "media/renderers/gpu_video_accelerator_factories.h" | 63 #include "media/renderers/gpu_video_accelerator_factories.h" |
| 64 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 64 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
| 65 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 65 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
| 66 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 66 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
| 67 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" | 67 #include "third_party/WebKit/public/platform/WebMediaStreamTrack.h" |
| 68 #include "third_party/WebKit/public/platform/WebURL.h" | 68 #include "third_party/WebKit/public/platform/WebURL.h" |
| 69 #include "third_party/WebKit/public/web/WebDocument.h" | 69 #include "third_party/WebKit/public/web/WebDocument.h" |
| 70 #include "third_party/WebKit/public/web/WebFrame.h" | 70 #include "third_party/WebKit/public/web/WebFrame.h" |
| 71 #include "third_party/webrtc/api/mediaconstraintsinterface.h" | 71 #include "third_party/webrtc/api/mediaconstraintsinterface.h" |
| 72 #include "third_party/webrtc/base/ssladapter.h" | 72 #include "third_party/webrtc/base/ssladapter.h" |
| 73 #include "third_party/webrtc/media/base/mediachannel.h" | |
| 73 #include "third_party/webrtc/modules/video_coding/codecs/h264/include/h264.h" | 74 #include "third_party/webrtc/modules/video_coding/codecs/h264/include/h264.h" |
| 74 | 75 |
| 75 #if defined(OS_ANDROID) | 76 #if defined(OS_ANDROID) |
| 76 #include "media/base/android/media_codec_util.h" | 77 #include "media/base/android/media_codec_util.h" |
| 77 #endif | 78 #endif |
| 78 | 79 |
| 79 namespace content { | 80 namespace content { |
| 80 | 81 |
| 81 namespace { | 82 namespace { |
| 82 | 83 |
| (...skipping 10 matching lines...) Expand all Loading... | |
| 93 return DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES; | 94 return DEFAULT_PUBLIC_AND_PRIVATE_INTERFACES; |
| 94 if (preference == kWebRTCIPHandlingDefaultPublicInterfaceOnly) | 95 if (preference == kWebRTCIPHandlingDefaultPublicInterfaceOnly) |
| 95 return DEFAULT_PUBLIC_INTERFACE_ONLY; | 96 return DEFAULT_PUBLIC_INTERFACE_ONLY; |
| 96 if (preference == kWebRTCIPHandlingDisableNonProxiedUdp) | 97 if (preference == kWebRTCIPHandlingDisableNonProxiedUdp) |
| 97 return DISABLE_NON_PROXIED_UDP; | 98 return DISABLE_NON_PROXIED_UDP; |
| 98 return DEFAULT; | 99 return DEFAULT; |
| 99 } | 100 } |
| 100 | 101 |
| 101 } // namespace | 102 } // namespace |
| 102 | 103 |
| 103 // Map of corresponding media constraints and platform effects. | |
| 104 struct { | |
| 105 const char* constraint; | |
| 106 const media::AudioParameters::PlatformEffectsMask effect; | |
| 107 } const kConstraintEffectMap[] = { | |
| 108 { webrtc::MediaConstraintsInterface::kGoogEchoCancellation, | |
| 109 media::AudioParameters::ECHO_CANCELLER }, | |
| 110 }; | |
| 111 | |
| 112 // If any platform effects are available, check them against the constraints. | |
| 113 // Disable effects to match false constraints, but if a constraint is true, set | |
| 114 // the constraint to false to later disable the software effect. | |
| 115 // | |
| 116 // This function may modify both |constraints| and |effects|. | |
| 117 void HarmonizeConstraintsAndEffects(RTCMediaConstraints* constraints, | |
| 118 int* effects) { | |
| 119 if (*effects != media::AudioParameters::NO_EFFECTS) { | |
| 120 for (size_t i = 0; i < arraysize(kConstraintEffectMap); ++i) { | |
| 121 bool value; | |
| 122 size_t is_mandatory = 0; | |
| 123 if (!webrtc::FindConstraint(constraints, | |
| 124 kConstraintEffectMap[i].constraint, | |
| 125 &value, | |
| 126 &is_mandatory) || !value) { | |
| 127 // If the constraint is false, or does not exist, disable the platform | |
| 128 // effect. | |
| 129 *effects &= ~kConstraintEffectMap[i].effect; | |
| 130 DVLOG(1) << "Disabling platform effect: " | |
| 131 << kConstraintEffectMap[i].effect; | |
| 132 } else if (*effects & kConstraintEffectMap[i].effect) { | |
| 133 // If the constraint is true, leave the platform effect enabled, and | |
| 134 // set the constraint to false to later disable the software effect. | |
| 135 if (is_mandatory) { | |
| 136 constraints->AddMandatory(kConstraintEffectMap[i].constraint, | |
| 137 webrtc::MediaConstraintsInterface::kValueFalse, true); | |
| 138 } else { | |
| 139 constraints->AddOptional(kConstraintEffectMap[i].constraint, | |
| 140 webrtc::MediaConstraintsInterface::kValueFalse, true); | |
| 141 } | |
| 142 DVLOG(1) << "Disabling constraint: " | |
| 143 << kConstraintEffectMap[i].constraint; | |
| 144 } | |
| 145 } | |
| 146 } | |
| 147 } | |
| 148 | |
| 149 PeerConnectionDependencyFactory::PeerConnectionDependencyFactory( | 104 PeerConnectionDependencyFactory::PeerConnectionDependencyFactory( |
| 150 P2PSocketDispatcher* p2p_socket_dispatcher) | 105 P2PSocketDispatcher* p2p_socket_dispatcher) |
| 151 : network_manager_(NULL), | 106 : network_manager_(NULL), |
| 152 p2p_socket_dispatcher_(p2p_socket_dispatcher), | 107 p2p_socket_dispatcher_(p2p_socket_dispatcher), |
| 153 signaling_thread_(NULL), | 108 signaling_thread_(NULL), |
| 154 worker_thread_(NULL), | 109 worker_thread_(NULL), |
| 155 chrome_signaling_thread_("Chrome_libJingle_Signaling"), | 110 chrome_signaling_thread_("Chrome_libJingle_Signaling"), |
| 156 chrome_worker_thread_("Chrome_libJingle_WorkerThread") { | 111 chrome_worker_thread_("Chrome_libJingle_WorkerThread") { |
| 157 TryScheduleStunProbeTrial(); | 112 TryScheduleStunProbeTrial(); |
| 158 } | 113 } |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 174 } | 129 } |
| 175 | 130 |
| 176 bool PeerConnectionDependencyFactory::InitializeMediaStreamAudioSource( | 131 bool PeerConnectionDependencyFactory::InitializeMediaStreamAudioSource( |
| 177 int render_frame_id, | 132 int render_frame_id, |
| 178 const blink::WebMediaConstraints& audio_constraints, | 133 const blink::WebMediaConstraints& audio_constraints, |
| 179 MediaStreamAudioSource* source_data) { | 134 MediaStreamAudioSource* source_data) { |
| 180 DVLOG(1) << "InitializeMediaStreamAudioSources()"; | 135 DVLOG(1) << "InitializeMediaStreamAudioSources()"; |
| 181 | 136 |
| 182 // Do additional source initialization if the audio source is a valid | 137 // Do additional source initialization if the audio source is a valid |
| 183 // microphone or tab audio. | 138 // microphone or tab audio. |
| 184 RTCMediaConstraints native_audio_constraints(audio_constraints); | |
| 185 MediaAudioConstraints::ApplyFixedAudioConstraints(&native_audio_constraints); | |
| 186 | 139 |
| 187 StreamDeviceInfo device_info = source_data->device_info(); | 140 StreamDeviceInfo device_info = source_data->device_info(); |
| 188 RTCMediaConstraints constraints = native_audio_constraints; | 141 |
| 189 // May modify both |constraints| and |effects|. | 142 cricket::AudioOptions options; |
| 190 HarmonizeConstraintsAndEffects(&constraints, | 143 // Apply relevant constraints. |
| 191 &device_info.device.input.effects); | 144 options.echo_cancellation = ConstraintToOptional( |
| 145 audio_constraints, &blink::WebMediaTrackConstraintSet::echoCancellation); | |
| 146 options.delay_agnostic_aec = ConstraintToOptional( | |
| 147 audio_constraints, | |
| 148 &blink::WebMediaTrackConstraintSet::googDAEchoCancellation); | |
| 149 options.auto_gain_control = ConstraintToOptional( | |
| 150 audio_constraints, | |
| 151 &blink::WebMediaTrackConstraintSet::googAutoGainControl); | |
| 152 options.experimental_agc = ConstraintToOptional( | |
| 153 audio_constraints, | |
| 154 &blink::WebMediaTrackConstraintSet::googExperimentalAutoGainControl); | |
| 155 options.noise_suppression = ConstraintToOptional( | |
| 156 audio_constraints, | |
| 157 &blink::WebMediaTrackConstraintSet::googNoiseSuppression); | |
| 158 options.experimental_ns = ConstraintToOptional( | |
| 159 audio_constraints, | |
| 160 &blink::WebMediaTrackConstraintSet::googExperimentalNoiseSuppression); | |
| 161 options.highpass_filter = ConstraintToOptional( | |
| 162 audio_constraints, | |
| 163 &blink::WebMediaTrackConstraintSet::googHighpassFilter); | |
| 164 options.typing_detection = ConstraintToOptional( | |
| 165 audio_constraints, | |
| 166 &blink::WebMediaTrackConstraintSet::googTypingNoiseDetection); | |
| 167 options.stereo_swapping = ConstraintToOptional( | |
| 168 audio_constraints, | |
| 169 &blink::WebMediaTrackConstraintSet::googAudioMirroring); | |
| 170 | |
| 171 MediaAudioConstraints::ApplyFixedAudioConstraints(&options); | |
| 172 | |
| 173 if (device_info.device.input.effects & | |
| 174 media::AudioParameters::ECHO_CANCELLER) { | |
| 175 // TODO(hta): Figure out if we should be looking at echoCancellation. | |
| 176 // Previous code had googEchoCancellation only. | |
|
tommi (sloooow) - chröme
2016/03/14 18:37:47
possibly. The echoCancellation constant controls
hta - Chromium
2016/03/15 06:47:33
It's more complex than that .... if echoCancellati
| |
| 177 const blink::BooleanConstraint& echoCancellation = | |
| 178 audio_constraints.basic().googEchoCancellation; | |
| 179 if (echoCancellation.hasExact() && !echoCancellation.exact()) { | |
| 180 device_info.device.input.effects &= | |
| 181 ~media::AudioParameters::ECHO_CANCELLER; | |
| 182 } | |
| 183 options.echo_cancellation = rtc::Optional<bool>(false); | |
| 184 } | |
| 192 | 185 |
| 193 scoped_ptr<WebRtcAudioCapturer> capturer = CreateAudioCapturer( | 186 scoped_ptr<WebRtcAudioCapturer> capturer = CreateAudioCapturer( |
| 194 render_frame_id, device_info, audio_constraints, source_data); | 187 render_frame_id, device_info, audio_constraints, source_data); |
| 195 if (!capturer.get()) { | 188 if (!capturer.get()) { |
| 196 const std::string log_string = | 189 const std::string log_string = |
| 197 "PCDF::InitializeMediaStreamAudioSource: fails to create capturer"; | 190 "PCDF::InitializeMediaStreamAudioSource: fails to create capturer"; |
| 198 WebRtcLogMessage(log_string); | 191 WebRtcLogMessage(log_string); |
| 199 DVLOG(1) << log_string; | 192 DVLOG(1) << log_string; |
| 200 // TODO(xians): Don't we need to check if source_observer is observing | 193 // TODO(xians): Don't we need to check if source_observer is observing |
| 201 // something? If not, then it looks like we have a leak here. | 194 // something? If not, then it looks like we have a leak here. |
| 202 // OTOH, if it _is_ observing something, then the callback might | 195 // OTOH, if it _is_ observing something, then the callback might |
| 203 // be called multiple times which is likely also a bug. | 196 // be called multiple times which is likely also a bug. |
| 204 return false; | 197 return false; |
| 205 } | 198 } |
| 206 source_data->SetAudioCapturer(std::move(capturer)); | 199 source_data->SetAudioCapturer(std::move(capturer)); |
| 207 | 200 |
| 208 // Creates a LocalAudioSource object which holds audio options. | 201 // Creates a LocalAudioSource object which holds audio options. |
| 209 // TODO(xians): The option should apply to the track instead of the source. | 202 // TODO(xians): The option should apply to the track instead of the source. |
| 210 // TODO(perkj): Move audio constraints parsing to Chrome. | 203 // TODO(perkj): Move audio constraints parsing to Chrome. |
| 211 // Currently there are a few constraints that are parsed by libjingle and | 204 // Currently there are a few constraints that are parsed by libjingle and |
| 212 // the state is set to ended if parsing fails. | 205 // the state is set to ended if parsing fails. |
| 213 scoped_refptr<webrtc::AudioSourceInterface> rtc_source( | 206 scoped_refptr<webrtc::AudioSourceInterface> rtc_source( |
| 214 CreateLocalAudioSource(&constraints).get()); | 207 CreateLocalAudioSource(options).get()); |
| 215 if (rtc_source->state() != webrtc::MediaSourceInterface::kLive) { | 208 if (rtc_source->state() != webrtc::MediaSourceInterface::kLive) { |
| 216 DLOG(WARNING) << "Failed to create rtc LocalAudioSource."; | 209 DLOG(WARNING) << "Failed to create rtc LocalAudioSource."; |
| 217 return false; | 210 return false; |
| 218 } | 211 } |
| 219 source_data->SetLocalAudioSource(rtc_source.get()); | 212 source_data->SetLocalAudioSource(rtc_source.get()); |
| 220 return true; | 213 return true; |
| 221 } | 214 } |
| 222 | 215 |
| 223 WebRtcVideoCapturerAdapter* | 216 WebRtcVideoCapturerAdapter* |
| 224 PeerConnectionDependencyFactory::CreateVideoCapturer( | 217 PeerConnectionDependencyFactory::CreateVideoCapturer( |
| 225 bool is_screeencast) { | 218 bool is_screeencast) { |
| 226 // We need to make sure the libjingle thread wrappers have been created | 219 // We need to make sure the libjingle thread wrappers have been created |
| 227 // before we can use an instance of a WebRtcVideoCapturerAdapter. This is | 220 // before we can use an instance of a WebRtcVideoCapturerAdapter. This is |
| 228 // since the base class of WebRtcVideoCapturerAdapter is a | 221 // since the base class of WebRtcVideoCapturerAdapter is a |
| 229 // cricket::VideoCapturer and it uses the libjingle thread wrappers. | 222 // cricket::VideoCapturer and it uses the libjingle thread wrappers. |
| 230 if (!GetPcFactory().get()) | 223 if (!GetPcFactory().get()) |
| 231 return NULL; | 224 return NULL; |
| 232 return new WebRtcVideoCapturerAdapter(is_screeencast); | 225 return new WebRtcVideoCapturerAdapter(is_screeencast); |
| 233 } | 226 } |
| 234 | 227 |
| 235 scoped_refptr<webrtc::VideoTrackSourceInterface> | 228 scoped_refptr<webrtc::VideoTrackSourceInterface> |
| 236 PeerConnectionDependencyFactory::CreateVideoSource( | 229 PeerConnectionDependencyFactory::CreateVideoSource( |
| 237 cricket::VideoCapturer* capturer, | 230 cricket::VideoCapturer* capturer) { |
| 238 const blink::WebMediaConstraints& constraints) { | |
| 239 RTCMediaConstraints webrtc_constraints(constraints); | |
| 240 scoped_refptr<webrtc::VideoTrackSourceInterface> source = | 231 scoped_refptr<webrtc::VideoTrackSourceInterface> source = |
| 241 GetPcFactory()->CreateVideoSource(capturer, &webrtc_constraints).get(); | 232 GetPcFactory()->CreateVideoSource(capturer).get(); |
| 242 return source; | 233 return source; |
| 243 } | 234 } |
| 244 | 235 |
| 245 const scoped_refptr<webrtc::PeerConnectionFactoryInterface>& | 236 const scoped_refptr<webrtc::PeerConnectionFactoryInterface>& |
| 246 PeerConnectionDependencyFactory::GetPcFactory() { | 237 PeerConnectionDependencyFactory::GetPcFactory() { |
| 247 if (!pc_factory_.get()) | 238 if (!pc_factory_.get()) |
| 248 CreatePeerConnectionFactory(); | 239 CreatePeerConnectionFactory(); |
| 249 CHECK(pc_factory_.get()); | 240 CHECK(pc_factory_.get()); |
| 250 return pc_factory_; | 241 return pc_factory_; |
| 251 } | 242 } |
| (...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 383 event->Signal(); | 374 event->Signal(); |
| 384 } | 375 } |
| 385 | 376 |
| 386 bool PeerConnectionDependencyFactory::PeerConnectionFactoryCreated() { | 377 bool PeerConnectionDependencyFactory::PeerConnectionFactoryCreated() { |
| 387 return pc_factory_.get() != NULL; | 378 return pc_factory_.get() != NULL; |
| 388 } | 379 } |
| 389 | 380 |
| 390 scoped_refptr<webrtc::PeerConnectionInterface> | 381 scoped_refptr<webrtc::PeerConnectionInterface> |
| 391 PeerConnectionDependencyFactory::CreatePeerConnection( | 382 PeerConnectionDependencyFactory::CreatePeerConnection( |
| 392 const webrtc::PeerConnectionInterface::RTCConfiguration& config, | 383 const webrtc::PeerConnectionInterface::RTCConfiguration& config, |
| 393 const webrtc::MediaConstraintsInterface* constraints, | |
| 394 blink::WebFrame* web_frame, | 384 blink::WebFrame* web_frame, |
| 395 webrtc::PeerConnectionObserver* observer) { | 385 webrtc::PeerConnectionObserver* observer) { |
| 396 CHECK(web_frame); | 386 CHECK(web_frame); |
| 397 CHECK(observer); | 387 CHECK(observer); |
| 398 if (!GetPcFactory().get()) | 388 if (!GetPcFactory().get()) |
| 399 return NULL; | 389 return NULL; |
| 400 | 390 |
| 401 rtc::scoped_ptr<PeerConnectionIdentityStore> identity_store( | 391 rtc::scoped_ptr<PeerConnectionIdentityStore> identity_store( |
| 402 new PeerConnectionIdentityStore( | 392 new PeerConnectionIdentityStore( |
| 403 base::ThreadTaskRunnerHandle::Get(), | 393 base::ThreadTaskRunnerHandle::Get(), |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 506 } | 496 } |
| 507 network_manager.reset(filtering_network_manager); | 497 network_manager.reset(filtering_network_manager); |
| 508 } else { | 498 } else { |
| 509 network_manager.reset(new EmptyNetworkManager(network_manager_)); | 499 network_manager.reset(new EmptyNetworkManager(network_manager_)); |
| 510 } | 500 } |
| 511 rtc::scoped_ptr<P2PPortAllocator> port_allocator(new P2PPortAllocator( | 501 rtc::scoped_ptr<P2PPortAllocator> port_allocator(new P2PPortAllocator( |
| 512 p2p_socket_dispatcher_, std::move(network_manager), socket_factory_.get(), | 502 p2p_socket_dispatcher_, std::move(network_manager), socket_factory_.get(), |
| 513 port_config, requesting_origin, chrome_worker_thread_.task_runner())); | 503 port_config, requesting_origin, chrome_worker_thread_.task_runner())); |
| 514 | 504 |
| 515 return GetPcFactory() | 505 return GetPcFactory() |
| 516 ->CreatePeerConnection(config, constraints, std::move(port_allocator), | 506 ->CreatePeerConnection(config, std::move(port_allocator), |
| 517 std::move(identity_store), observer) | 507 std::move(identity_store), observer) |
| 518 .get(); | 508 .get(); |
| 519 } | 509 } |
| 520 | 510 |
| 521 scoped_refptr<webrtc::MediaStreamInterface> | 511 scoped_refptr<webrtc::MediaStreamInterface> |
| 522 PeerConnectionDependencyFactory::CreateLocalMediaStream( | 512 PeerConnectionDependencyFactory::CreateLocalMediaStream( |
| 523 const std::string& label) { | 513 const std::string& label) { |
| 524 return GetPcFactory()->CreateLocalMediaStream(label).get(); | 514 return GetPcFactory()->CreateLocalMediaStream(label).get(); |
| 525 } | 515 } |
| 526 | 516 |
| 527 scoped_refptr<webrtc::AudioSourceInterface> | 517 scoped_refptr<webrtc::AudioSourceInterface> |
| 528 PeerConnectionDependencyFactory::CreateLocalAudioSource( | 518 PeerConnectionDependencyFactory::CreateLocalAudioSource( |
| 529 const webrtc::MediaConstraintsInterface* constraints) { | 519 const cricket::AudioOptions& options) { |
| 530 scoped_refptr<webrtc::AudioSourceInterface> source = | 520 scoped_refptr<webrtc::AudioSourceInterface> source = |
| 531 GetPcFactory()->CreateAudioSource(constraints).get(); | 521 GetPcFactory()->CreateAudioSource(options).get(); |
| 532 return source; | 522 return source; |
| 533 } | 523 } |
| 534 | 524 |
| 535 void PeerConnectionDependencyFactory::CreateLocalAudioTrack( | 525 void PeerConnectionDependencyFactory::CreateLocalAudioTrack( |
| 536 const blink::WebMediaStreamTrack& track) { | 526 const blink::WebMediaStreamTrack& track) { |
| 537 blink::WebMediaStreamSource source = track.source(); | 527 blink::WebMediaStreamSource source = track.source(); |
| 538 DCHECK_EQ(source.getType(), blink::WebMediaStreamSource::TypeAudio); | 528 DCHECK_EQ(source.getType(), blink::WebMediaStreamSource::TypeAudio); |
| 539 MediaStreamAudioSource* source_data = MediaStreamAudioSource::From(source); | 529 MediaStreamAudioSource* source_data = MediaStreamAudioSource::From(source); |
| 540 | 530 |
| 541 if (!source_data) { | 531 if (!source_data) { |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 598 void PeerConnectionDependencyFactory::CreateWebAudioSource( | 588 void PeerConnectionDependencyFactory::CreateWebAudioSource( |
| 599 blink::WebMediaStreamSource* source) { | 589 blink::WebMediaStreamSource* source) { |
| 600 DVLOG(1) << "PeerConnectionDependencyFactory::CreateWebAudioSource()"; | 590 DVLOG(1) << "PeerConnectionDependencyFactory::CreateWebAudioSource()"; |
| 601 | 591 |
| 602 MediaStreamAudioSource* source_data = new MediaStreamAudioSource(); | 592 MediaStreamAudioSource* source_data = new MediaStreamAudioSource(); |
| 603 source_data->SetWebAudioCapturer( | 593 source_data->SetWebAudioCapturer( |
| 604 make_scoped_ptr(new WebAudioCapturerSource(source))); | 594 make_scoped_ptr(new WebAudioCapturerSource(source))); |
| 605 | 595 |
| 606 // Create a LocalAudioSource object which holds audio options. | 596 // Create a LocalAudioSource object which holds audio options. |
| 607 // SetLocalAudioSource() affects core audio parts in third_party/Libjingle. | 597 // SetLocalAudioSource() affects core audio parts in third_party/Libjingle. |
| 608 source_data->SetLocalAudioSource(CreateLocalAudioSource(NULL).get()); | 598 cricket::AudioOptions options; |
| 599 source_data->SetLocalAudioSource(CreateLocalAudioSource(options).get()); | |
| 609 source->setExtraData(source_data); | 600 source->setExtraData(source_data); |
| 610 } | 601 } |
| 611 | 602 |
| 612 scoped_refptr<webrtc::VideoTrackInterface> | 603 scoped_refptr<webrtc::VideoTrackInterface> |
| 613 PeerConnectionDependencyFactory::CreateLocalVideoTrack( | 604 PeerConnectionDependencyFactory::CreateLocalVideoTrack( |
| 614 const std::string& id, | 605 const std::string& id, |
| 615 webrtc::VideoTrackSourceInterface* source) { | 606 webrtc::VideoTrackSourceInterface* source) { |
| 616 return GetPcFactory()->CreateVideoTrack(id, source).get(); | 607 return GetPcFactory()->CreateVideoTrack(id, source).get(); |
| 617 } | 608 } |
| 618 | 609 |
| (...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 785 } | 776 } |
| 786 | 777 |
| 787 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { | 778 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { |
| 788 if (audio_device_.get()) | 779 if (audio_device_.get()) |
| 789 return; | 780 return; |
| 790 | 781 |
| 791 audio_device_ = new WebRtcAudioDeviceImpl(); | 782 audio_device_ = new WebRtcAudioDeviceImpl(); |
| 792 } | 783 } |
| 793 | 784 |
| 794 } // namespace content | 785 } // namespace content |
| OLD | NEW |