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

Unified Diff: content/renderer/media/media_stream_center.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: Addressed comments from PS2: AudioInputDevice --> AudioCapturerSource, and refptr foo in WebRtcMedi… Created 4 years, 9 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/media_stream_center.cc
diff --git a/content/renderer/media/media_stream_center.cc b/content/renderer/media/media_stream_center.cc
index 2f84bd8eb2be103006c91c73cc75aaf3952521a6..afaae406f9a4784623bdf726d66b42a1e3534d87 100644
--- a/content/renderer/media/media_stream_center.cc
+++ b/content/renderer/media/media_stream_center.cc
@@ -19,6 +19,7 @@
#include "content/renderer/media/media_stream_source.h"
#include "content/renderer/media/media_stream_video_source.h"
#include "content/renderer/media/media_stream_video_track.h"
+#include "content/renderer/media/webaudio_media_stream_source.h"
#include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
#include "content/renderer/media/webrtc_local_audio_source_provider.h"
#include "third_party/WebKit/public/platform/WebMediaConstraints.h"
@@ -41,14 +42,27 @@ namespace {
void CreateNativeAudioMediaStreamTrack(
const blink::WebMediaStreamTrack& track,
PeerConnectionDependencyFactory* factory) {
perkj_chrome 2016/04/08 14:05:42 please remove |factory| I think this might be the
miu 2016/04/19 00:40:22 Done. Yes it is! :) I've removed |rtc_factory_|
- DCHECK(!MediaStreamAudioTrack::From(track));
blink::WebMediaStreamSource source = track.source();
- DCHECK_EQ(source.getType(), blink::WebMediaStreamSource::TypeAudio);
- if (source.remote()) {
- factory->CreateRemoteAudioTrack(track);
- } else {
- factory->CreateLocalAudioTrack(track);
+ MediaStreamAudioSource* media_stream_source =
+ MediaStreamAudioSource::From(source);
+
+ // At this point, a MediaStreamAudioSource instance must exist. The one
+ // exception is when a WebAudio destination node is acting as a source of
+ // audio.
+ //
+ // TODO(miu): This needs to be moved to an appropriate location. A WebAudio
+ // source should have been created before this method was called so that this
+ // special case code isn't needed here.
+ if (!media_stream_source && source.requiresAudioConsumer()) {
+ DVLOG(1) << "Creating WebAudio media stream source.";
+ media_stream_source = new WebAudioMediaStreamSource(&source);
+ source.setExtraData(media_stream_source); // Takes ownership.
}
+
+ if (media_stream_source)
+ media_stream_source->ConnectToTrack(track);
+ else
+ LOG(DFATAL) << "WebMediaStreamSource missing its MediaStreamAudioSource.";
}
void CreateNativeVideoMediaStreamTrack(

Powered by Google App Engine
This is Rietveld 408576698