Chromium Code Reviews| 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()); |