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 <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/strings/stringprintf.h" | |
10 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
11 #include "base/synchronization/waitable_event.h" | 12 #include "base/synchronization/waitable_event.h" |
12 #include "content/common/media/media_stream_messages.h" | 13 #include "content/common/media/media_stream_messages.h" |
13 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
14 #include "content/renderer/media/media_stream.h" | 15 #include "content/renderer/media/media_stream.h" |
15 #include "content/renderer/media/media_stream_audio_processor.h" | 16 #include "content/renderer/media/media_stream_audio_processor.h" |
16 #include "content/renderer/media/media_stream_audio_processor_options.h" | 17 #include "content/renderer/media/media_stream_audio_processor_options.h" |
17 #include "content/renderer/media/media_stream_audio_source.h" | 18 #include "content/renderer/media/media_stream_audio_source.h" |
18 #include "content/renderer/media/media_stream_video_source.h" | 19 #include "content/renderer/media/media_stream_video_source.h" |
19 #include "content/renderer/media/media_stream_video_track.h" | 20 #include "content/renderer/media/media_stream_video_track.h" |
20 #include "content/renderer/media/peer_connection_identity_service.h" | 21 #include "content/renderer/media/peer_connection_identity_service.h" |
21 #include "content/renderer/media/rtc_media_constraints.h" | 22 #include "content/renderer/media/rtc_media_constraints.h" |
22 #include "content/renderer/media/rtc_peer_connection_handler.h" | 23 #include "content/renderer/media/rtc_peer_connection_handler.h" |
23 #include "content/renderer/media/rtc_video_decoder_factory.h" | 24 #include "content/renderer/media/rtc_video_decoder_factory.h" |
24 #include "content/renderer/media/rtc_video_encoder_factory.h" | 25 #include "content/renderer/media/rtc_video_encoder_factory.h" |
25 #include "content/renderer/media/webaudio_capturer_source.h" | 26 #include "content/renderer/media/webaudio_capturer_source.h" |
26 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" | 27 #include "content/renderer/media/webrtc/webrtc_local_audio_track_adapter.h" |
27 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" | 28 #include "content/renderer/media/webrtc/webrtc_video_capturer_adapter.h" |
28 #include "content/renderer/media/webrtc_audio_device_impl.h" | 29 #include "content/renderer/media/webrtc_audio_device_impl.h" |
29 #include "content/renderer/media/webrtc_local_audio_track.h" | 30 #include "content/renderer/media/webrtc_local_audio_track.h" |
31 #include "content/renderer/media/webrtc_logging.h" | |
30 #include "content/renderer/media/webrtc_uma_histograms.h" | 32 #include "content/renderer/media/webrtc_uma_histograms.h" |
31 #include "content/renderer/p2p/ipc_network_manager.h" | 33 #include "content/renderer/p2p/ipc_network_manager.h" |
32 #include "content/renderer/p2p/ipc_socket_factory.h" | 34 #include "content/renderer/p2p/ipc_socket_factory.h" |
33 #include "content/renderer/p2p/port_allocator.h" | 35 #include "content/renderer/p2p/port_allocator.h" |
34 #include "content/renderer/render_thread_impl.h" | 36 #include "content/renderer/render_thread_impl.h" |
35 #include "jingle/glue/thread_wrapper.h" | 37 #include "jingle/glue/thread_wrapper.h" |
36 #include "media/filters/gpu_video_accelerator_factories.h" | 38 #include "media/filters/gpu_video_accelerator_factories.h" |
37 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" | 39 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" |
38 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 40 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
39 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" | 41 #include "third_party/WebKit/public/platform/WebMediaStreamSource.h" |
(...skipping 169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
209 StreamDeviceInfo device_info = source_data->device_info(); | 211 StreamDeviceInfo device_info = source_data->device_info(); |
210 RTCMediaConstraints constraints = native_audio_constraints; | 212 RTCMediaConstraints constraints = native_audio_constraints; |
211 // May modify both |constraints| and |effects|. | 213 // May modify both |constraints| and |effects|. |
212 HarmonizeConstraintsAndEffects(&constraints, | 214 HarmonizeConstraintsAndEffects(&constraints, |
213 &device_info.device.input.effects); | 215 &device_info.device.input.effects); |
214 | 216 |
215 scoped_refptr<WebRtcAudioCapturer> capturer( | 217 scoped_refptr<WebRtcAudioCapturer> capturer( |
216 CreateAudioCapturer(render_view_id, device_info, audio_constraints, | 218 CreateAudioCapturer(render_view_id, device_info, audio_constraints, |
217 source_data)); | 219 source_data)); |
218 if (!capturer.get()) { | 220 if (!capturer.get()) { |
219 DLOG(WARNING) << "Failed to create the capturer for device " | 221 std::string log_string = base::StringPrintf( |
no longer working on chromium
2014/09/05 12:57:23
nit, const std::string
henrika (OOO until Aug 14)
2014/09/05 13:02:21
Done.
| |
220 << device_info.device.id; | 222 "PCDF::InitializeMediaStreamAudioSource: " |
223 "fails to create capturer for device %s", | |
224 device_info.device.id.c_str()); | |
no longer working on chromium
2014/09/05 12:57:23
You can't log the device id.
henrika (OOO until Aug 14)
2014/09/05 13:02:21
Yes I can ;-)
| |
225 WebRtcLogMessage(log_string); | |
226 DVLOG(1) << log_string; | |
221 // TODO(xians): Don't we need to check if source_observer is observing | 227 // TODO(xians): Don't we need to check if source_observer is observing |
222 // something? If not, then it looks like we have a leak here. | 228 // something? If not, then it looks like we have a leak here. |
223 // OTOH, if it _is_ observing something, then the callback might | 229 // OTOH, if it _is_ observing something, then the callback might |
224 // be called multiple times which is likely also a bug. | 230 // be called multiple times which is likely also a bug. |
225 return false; | 231 return false; |
226 } | 232 } |
227 source_data->SetAudioCapturer(capturer.get()); | 233 source_data->SetAudioCapturer(capturer.get()); |
228 | 234 |
229 // Creates a LocalAudioSource object which holds audio options. | 235 // Creates a LocalAudioSource object which holds audio options. |
230 // TODO(xians): The option should apply to the track instead of the source. | 236 // TODO(xians): The option should apply to the track instead of the source. |
(...skipping 423 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
654 } | 660 } |
655 | 661 |
656 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { | 662 void PeerConnectionDependencyFactory::EnsureWebRtcAudioDeviceImpl() { |
657 if (audio_device_.get()) | 663 if (audio_device_.get()) |
658 return; | 664 return; |
659 | 665 |
660 audio_device_ = new WebRtcAudioDeviceImpl(); | 666 audio_device_ = new WebRtcAudioDeviceImpl(); |
661 } | 667 } |
662 | 668 |
663 } // namespace content | 669 } // namespace content |
OLD | NEW |