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/media_stream_renderer_factory_impl.h" | 5 #include "content/renderer/media/media_stream_renderer_factory_impl.h" |
6 | 6 |
7 #include "base/strings/utf_string_conversions.h" | 7 #include "base/strings/utf_string_conversions.h" |
8 #include "content/renderer/media/media_stream.h" | 8 #include "content/renderer/media/media_stream.h" |
9 #include "content/renderer/media/media_stream_audio_track.h" | 9 #include "content/renderer/media/media_stream_audio_track.h" |
10 #include "content/renderer/media/media_stream_video_renderer_sink.h" | 10 #include "content/renderer/media/media_stream_video_renderer_sink.h" |
11 #include "content/renderer/media/media_stream_video_track.h" | 11 #include "content/renderer/media/media_stream_video_track.h" |
12 #include "content/renderer/media/track_audio_renderer.h" | 12 #include "content/renderer/media/track_audio_renderer.h" |
13 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" | 13 #include "content/renderer/media/webrtc/peer_connection_dependency_factory.h" |
14 #include "content/renderer/media/webrtc/peer_connection_remote_audio_source.h" | |
14 #include "content/renderer/media/webrtc_audio_renderer.h" | 15 #include "content/renderer/media/webrtc_audio_renderer.h" |
15 #include "content/renderer/render_thread_impl.h" | 16 #include "content/renderer/render_thread_impl.h" |
16 #include "media/base/audio_hardware_config.h" | 17 #include "media/base/audio_hardware_config.h" |
17 #include "third_party/WebKit/public/platform/WebMediaStream.h" | 18 #include "third_party/WebKit/public/platform/WebMediaStream.h" |
18 #include "third_party/WebKit/public/platform/WebURL.h" | 19 #include "third_party/WebKit/public/platform/WebURL.h" |
19 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" | 20 #include "third_party/WebKit/public/web/WebMediaStreamRegistry.h" |
20 #include "third_party/webrtc/api/mediastreaminterface.h" | 21 #include "third_party/webrtc/api/mediastreaminterface.h" |
21 | 22 |
22 namespace content { | 23 namespace content { |
23 | 24 |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
113 MediaStreamAudioTrack::From(audio_tracks[0]); | 114 MediaStreamAudioTrack::From(audio_tracks[0]); |
114 if (!audio_track) { | 115 if (!audio_track) { |
115 // This can happen if the track was cloned. | 116 // This can happen if the track was cloned. |
116 // TODO(tommi, perkj): Fix cloning of tracks to handle extra data too. | 117 // TODO(tommi, perkj): Fix cloning of tracks to handle extra data too. |
117 LOG(ERROR) << "No native track for WebMediaStreamTrack."; | 118 LOG(ERROR) << "No native track for WebMediaStreamTrack."; |
118 return nullptr; | 119 return nullptr; |
119 } | 120 } |
120 | 121 |
121 // If the track has a local source, or is a remote track that does not use the | 122 // If the track has a local source, or is a remote track that does not use the |
122 // WebRTC audio pipeline, return a new TrackAudioRenderer instance. | 123 // WebRTC audio pipeline, return a new TrackAudioRenderer instance. |
123 // | 124 if (!PeerConnectionRemoteAudioTrack::From(audio_track)) { |
perkj_chrome
2016/04/08 14:05:42
PeerConnectionRemoteAudioTrack is probably not nee
miu
2016/04/19 00:40:22
Acknowledged.
| |
124 // TODO(miu): In a soon up-coming change, I'll introduce a cleaner way (i.e., | |
125 // rather than calling GetAudioAdapter()) to determine whether a remote source | |
126 // is via WebRTC or something else. | |
127 if (audio_track->is_local_track() || !audio_track->GetAudioAdapter()) { | |
128 // TODO(xians): Add support for the case where the media stream contains | 125 // TODO(xians): Add support for the case where the media stream contains |
129 // multiple audio tracks. | 126 // multiple audio tracks. |
130 DVLOG(1) << "Creating TrackAudioRenderer for " | 127 DVLOG(1) << "Creating TrackAudioRenderer for " |
131 << (audio_track->is_local_track() ? "local" : "remote") | 128 << (audio_track->is_local_track() ? "local" : "remote") |
132 << " track."; | 129 << " track."; |
133 return new TrackAudioRenderer(audio_tracks[0], render_frame_id, | 130 return new TrackAudioRenderer(audio_tracks[0], render_frame_id, |
134 0 /* no session_id */, device_id, | 131 0 /* no session_id */, device_id, |
135 security_origin); | 132 security_origin); |
136 } | 133 } |
137 | 134 |
(...skipping 14 matching lines...) Expand all Loading... | |
152 device_id, security_origin); | 149 device_id, security_origin); |
153 | 150 |
154 if (!audio_device->SetAudioRenderer(renderer.get())) | 151 if (!audio_device->SetAudioRenderer(renderer.get())) |
155 return nullptr; | 152 return nullptr; |
156 } | 153 } |
157 | 154 |
158 return renderer->CreateSharedAudioRendererProxy(web_stream); | 155 return renderer->CreateSharedAudioRendererProxy(web_stream); |
159 } | 156 } |
160 | 157 |
161 } // namespace content | 158 } // namespace content |
OLD | NEW |