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

Unified Diff: third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.cpp

Issue 2699403002: Simplify MediaStreamAudioSourceNode ownerships. (Closed)
Patch Set: Created 3 years, 10 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 | « third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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,
« no previous file with comments | « third_party/WebKit/Source/modules/webaudio/MediaStreamAudioSourceNode.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698