Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(19)

Side by Side Diff: content/renderer/media/media_stream_renderer_factory_impl.cc

Issue 1647773002: MediaStream audio sourcing: Bypass audio processing for non-WebRTC cases. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: NOT FOR REVIEW -- This will be broken-up across multiple CLs. Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 DVLOG(1) << "MediaStreamRendererFactoryImpl::GetAudioRenderer stream:" 103 DVLOG(1) << "MediaStreamRendererFactoryImpl::GetAudioRenderer stream:"
103 << base::UTF16ToUTF8(base::StringPiece16(web_stream.id())); 104 << base::UTF16ToUTF8(base::StringPiece16(web_stream.id()));
104 105
105 // TODO(tommi): We need to fix the data flow so that 106 // TODO(tommi): We need to fix the data flow so that
106 // it works the same way for all track implementations, local, remote or what 107 // it works the same way for all track implementations, local, remote or what
107 // have you. 108 // have you.
108 // In this function, we should simply create a renderer object that receives 109 // In this function, we should simply create a renderer object that receives
109 // and mixes audio from all the tracks that belong to the media stream. 110 // and mixes audio from all the tracks that belong to the media stream.
110 // For now, we have separate renderers depending on if the first audio track 111 // For now, we have separate renderers depending on if the first audio track
111 // in the stream is local or remote. 112 // in the stream is local or remote.
112 MediaStreamAudioTrack* audio_track = MediaStreamAudioTrack::GetTrack( 113 MediaStreamAudioTrack* const audio_track =
113 audio_tracks[0]); 114 MediaStreamAudioTrack::Get(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 PeerConnectionRemoteAudioTrack* const pc_remote_audio_track =
124 // TODO(miu): In a soon up-coming change, I'll introduce a cleaner way (i.e., 125 PeerConnectionRemoteAudioTrack::From(audio_track);
125 // rather than calling GetAudioAdapter()) to determine whether a remote source 126 if (audio_track->is_local_track() || !pc_remote_audio_track) {
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 127 // TODO(xians): Add support for the case where the media stream contains
129 // multiple audio tracks. 128 // multiple audio tracks.
130 DVLOG(1) << "Creating TrackAudioRenderer for " 129 DVLOG(1) << "Creating TrackAudioRenderer for "
131 << (audio_track->is_local_track() ? "local" : "remote") 130 << (audio_track->is_local_track() ? "local" : "remote")
132 << " track."; 131 << " track.";
133 return new TrackAudioRenderer(audio_tracks[0], render_frame_id, 132 return new TrackAudioRenderer(audio_tracks[0], render_frame_id,
134 0 /* no session_id */, device_id, 133 0 /* no session_id */, device_id,
135 security_origin); 134 security_origin);
136 } 135 }
137 136
(...skipping 14 matching lines...) Expand all
152 device_id, security_origin); 151 device_id, security_origin);
153 152
154 if (!audio_device->SetAudioRenderer(renderer.get())) 153 if (!audio_device->SetAudioRenderer(renderer.get()))
155 return nullptr; 154 return nullptr;
156 } 155 }
157 156
158 return renderer->CreateSharedAudioRendererProxy(web_stream); 157 return renderer->CreateSharedAudioRendererProxy(web_stream);
159 } 158 }
160 159
161 } // namespace content 160 } // namespace content
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_center.cc ('k') | content/renderer/media/media_stream_source.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698