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

Unified Diff: Source/modules/webaudio/AudioContext.cpp

Issue 202923007: create one WebAudioSource for each CreateMediaStreamSource() call. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « no previous file | Source/modules/webaudio/MediaStreamAudioSourceNode.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/modules/webaudio/AudioContext.cpp
diff --git a/Source/modules/webaudio/AudioContext.cpp b/Source/modules/webaudio/AudioContext.cpp
index 934a5d0e32b858687ecbbdca1b134b167e4a1ace..34eb2fd2d40acd1e81edd52611a4a7f4317f5006 100644
--- a/Source/modules/webaudio/AudioContext.cpp
+++ b/Source/modules/webaudio/AudioContext.cpp
@@ -393,21 +393,18 @@ PassRefPtr<MediaStreamAudioSourceNode> AudioContext::createMediaStreamSource(Med
ASSERT(isMainThread());
lazyInitialize();
- AudioSourceProvider* provider = 0;
-
MediaStreamTrackVector audioTracks = mediaStream->getAudioTracks();
- RefPtr<MediaStreamTrack> audioTrack;
-
- // FIXME: get a provider for non-local MediaStreams (like from a remote peer).
- for (size_t i = 0; i < audioTracks.size(); ++i) {
- audioTrack = audioTracks[i];
- if (audioTrack->component()->audioSourceProvider()) {
- provider = audioTrack->component()->audioSourceProvider();
- break;
- }
+ if (audioTracks.isEmpty()) {
+ exceptionState.throwDOMException(
+ InvalidStateError,
+ "MediaStream has no audio track");
+ return nullptr;
}
- RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create(this, mediaStream, audioTrack.get(), provider);
+ // Use the first audio track in the media stream.
+ RefPtr<MediaStreamTrack> audioTrack = audioTracks[0];
+ OwnPtr<AudioSourceProvider> provider = audioTrack->createWebAudioSource();
Raymond Toy 2014/03/25 22:35:41 Are lines 405-406 here the same as the original li
no longer working on chromium 2014/03/26 13:31:11 Yes, they are the same. Chrome guarantees that the
Raymond Toy 2014/03/26 17:04:46 Thanks for the very detailed explanation. This sou
+ RefPtr<MediaStreamAudioSourceNode> node = MediaStreamAudioSourceNode::create(this, mediaStream, audioTrack.get(), provider.release());
// FIXME: Only stereo streams are supported right now. We should be able to accept multi-channel streams.
node->setFormat(2, sampleRate());
« no previous file with comments | « no previous file | Source/modules/webaudio/MediaStreamAudioSourceNode.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698