Index: third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp |
diff --git a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp |
index 04e14ae08945bcb6e03762a499a4dd7f46c6cde5..d716066900db067bfc41c8edc08bcfa7f3da12e3 100644 |
--- a/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp |
+++ b/third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp |
@@ -36,14 +36,10 @@ namespace blink { |
MediaStreamAudioSourceHandler::MediaStreamAudioSourceHandler( |
AudioNode& node, |
- MediaStream& mediaStream, |
- MediaStreamTrack* audioTrack, |
std::unique_ptr<AudioSourceProvider> audioSourceProvider) |
: AudioHandler(NodeTypeMediaStreamAudioSource, |
node, |
node.context()->sampleRate()), |
- m_mediaStream(mediaStream), |
- m_audioTrack(audioTrack), |
m_audioSourceProvider(std::move(audioSourceProvider)), |
m_sourceNumberOfChannels(0) { |
// Default to stereo. This could change depending on the format of the |
@@ -55,11 +51,9 @@ MediaStreamAudioSourceHandler::MediaStreamAudioSourceHandler( |
PassRefPtr<MediaStreamAudioSourceHandler> MediaStreamAudioSourceHandler::create( |
AudioNode& node, |
- MediaStream& mediaStream, |
- MediaStreamTrack* audioTrack, |
std::unique_ptr<AudioSourceProvider> audioSourceProvider) { |
- return adoptRef(new MediaStreamAudioSourceHandler( |
- node, mediaStream, audioTrack, std::move(audioSourceProvider))); |
+ return adoptRef( |
+ new MediaStreamAudioSourceHandler(node, std::move(audioSourceProvider))); |
} |
MediaStreamAudioSourceHandler::~MediaStreamAudioSourceHandler() { |
@@ -104,8 +98,7 @@ void MediaStreamAudioSourceHandler::process(size_t numberOfFrames) { |
return; |
} |
- if (!getMediaStream() || |
- m_sourceNumberOfChannels != outputBus->numberOfChannels()) { |
+ if (m_sourceNumberOfChannels != outputBus->numberOfChannels()) { |
outputBus->zero(); |
return; |
} |
@@ -129,9 +122,9 @@ MediaStreamAudioSourceNode::MediaStreamAudioSourceNode( |
MediaStream& mediaStream, |
MediaStreamTrack* audioTrack, |
std::unique_ptr<AudioSourceProvider> audioSourceProvider) |
- : AudioNode(context) { |
+ : AudioNode(context), m_audioTrack(audioTrack), m_mediaStream(mediaStream) { |
setHandler(MediaStreamAudioSourceHandler::create( |
- *this, mediaStream, audioTrack, std::move(audioSourceProvider))); |
+ *this, std::move(audioSourceProvider))); |
} |
MediaStreamAudioSourceNode* MediaStreamAudioSourceNode::create( |
@@ -180,6 +173,8 @@ MediaStreamAudioSourceNode* MediaStreamAudioSourceNode::create( |
} |
DEFINE_TRACE(MediaStreamAudioSourceNode) { |
+ visitor->trace(m_audioTrack); |
+ visitor->trace(m_mediaStream); |
AudioSourceProviderClient::trace(visitor); |
AudioNode::trace(visitor); |
} |
@@ -190,7 +185,7 @@ MediaStreamAudioSourceNode::mediaStreamAudioSourceHandler() const { |
} |
MediaStream* MediaStreamAudioSourceNode::getMediaStream() const { |
- return mediaStreamAudioSourceHandler().getMediaStream(); |
+ return m_mediaStream; |
} |
void MediaStreamAudioSourceNode::setFormat(size_t numberOfChannels, |