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

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

Issue 1834323002: MediaStream audio: Refactor 3 separate "glue" implementations into one. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE + Workaround to ensure MediaStreamAudioProcessor is destroyed on the main thread. Created 4 years, 7 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/webrtc/api/mediastreaminterface.h" 19 #include "third_party/webrtc/api/mediastreaminterface.h"
19 20
20 namespace content { 21 namespace content {
21 22
22 namespace { 23 namespace {
23 24
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after
107 MediaStreamAudioTrack::From(audio_tracks[0]); 108 MediaStreamAudioTrack::From(audio_tracks[0]);
108 if (!audio_track) { 109 if (!audio_track) {
109 // This can happen if the track was cloned. 110 // This can happen if the track was cloned.
110 // TODO(tommi, perkj): Fix cloning of tracks to handle extra data too. 111 // TODO(tommi, perkj): Fix cloning of tracks to handle extra data too.
111 LOG(ERROR) << "No native track for WebMediaStreamTrack."; 112 LOG(ERROR) << "No native track for WebMediaStreamTrack.";
112 return nullptr; 113 return nullptr;
113 } 114 }
114 115
115 // If the track has a local source, or is a remote track that does not use the 116 // If the track has a local source, or is a remote track that does not use the
116 // WebRTC audio pipeline, return a new TrackAudioRenderer instance. 117 // WebRTC audio pipeline, return a new TrackAudioRenderer instance.
117 // 118 if (!PeerConnectionRemoteAudioTrack::From(audio_track)) {
118 // TODO(miu): In a soon up-coming change, I'll introduce a cleaner way (i.e.,
119 // rather than calling GetAudioAdapter()) to determine whether a remote source
120 // is via WebRTC or something else.
121 if (audio_track->is_local_track() || !audio_track->GetAudioAdapter()) {
122 // TODO(xians): Add support for the case where the media stream contains 119 // TODO(xians): Add support for the case where the media stream contains
123 // multiple audio tracks. 120 // multiple audio tracks.
124 DVLOG(1) << "Creating TrackAudioRenderer for " 121 DVLOG(1) << "Creating TrackAudioRenderer for "
125 << (audio_track->is_local_track() ? "local" : "remote") 122 << (audio_track->is_local_track() ? "local" : "remote")
126 << " track."; 123 << " track.";
127 return new TrackAudioRenderer(audio_tracks[0], render_frame_id, 124 return new TrackAudioRenderer(audio_tracks[0], render_frame_id,
128 0 /* no session_id */, device_id, 125 0 /* no session_id */, device_id,
129 security_origin); 126 security_origin);
130 } 127 }
131 128
(...skipping 14 matching lines...) Expand all
146 device_id, security_origin); 143 device_id, security_origin);
147 144
148 if (!audio_device->SetAudioRenderer(renderer.get())) 145 if (!audio_device->SetAudioRenderer(renderer.get()))
149 return nullptr; 146 return nullptr;
150 } 147 }
151 148
152 return renderer->CreateSharedAudioRendererProxy(web_stream); 149 return renderer->CreateSharedAudioRendererProxy(web_stream);
153 } 150 }
154 151
155 } // namespace content 152 } // 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