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

Unified Diff: content/renderer/media/webaudio_capturer_source.h

Issue 1721273002: MediaStream audio object graph untangling and clean-ups. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE 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/webaudio_capturer_source.h
diff --git a/content/renderer/media/webaudio_capturer_source.h b/content/renderer/media/webaudio_capturer_source.h
index d5b3bb5b554514d8d75ee909bf8ab23f63914279..f127de3aa2fbdc1f753fb89e4e698be283c04ad2 100644
--- a/content/renderer/media/webaudio_capturer_source.h
+++ b/content/renderer/media/webaudio_capturer_source.h
@@ -8,7 +8,6 @@
#include <stddef.h>
#include "base/macros.h"
-#include "base/memory/ref_counted.h"
#include "base/synchronization/lock.h"
#include "base/threading/thread_checker.h"
#include "base/time/time.h"
@@ -31,12 +30,11 @@ class WebRtcLocalAudioTrack;
// (channels, and sample-rate).
// 2. consumeAudio() is called periodically by WebKit which dispatches the
// audio stream to the WebRtcLocalAudioTrack::Capture() method.
-class WebAudioCapturerSource
- : public base::RefCountedThreadSafe<WebAudioCapturerSource>,
- public blink::WebAudioDestinationConsumer {
+class WebAudioCapturerSource : public blink::WebAudioDestinationConsumer {
public:
- explicit WebAudioCapturerSource(
- const blink::WebMediaStreamSource& blink_source);
+ explicit WebAudioCapturerSource(blink::WebMediaStreamSource* blink_source);
+
+ ~WebAudioCapturerSource() override;
// WebAudioDestinationConsumer implementation.
// setFormat() is called early on, so that we can configure the audio track.
@@ -47,18 +45,13 @@ class WebAudioCapturerSource
size_t number_of_frames) override;
// Called when the WebAudioCapturerSource is hooking to a media audio track.
- // |track| is the sink of the data flow. |source_provider| is the source of
- // the data flow where stream information like delay, volume, key_pressed,
- // is stored.
+ // |track| is the sink of the data flow and must remain alive until Stop() is
+ // called.
void Start(WebRtcLocalAudioTrack* track);
// Called when the media audio track is stopping.
void Stop();
- protected:
- friend class base::RefCountedThreadSafe<WebAudioCapturerSource>;
- ~WebAudioCapturerSource() override;
-
private:
// Called by AudioPushFifo zero or more times during the call to
// consumeAudio(). Delivers audio data with the required buffer size to the
@@ -66,16 +59,13 @@ class WebAudioCapturerSource
void DeliverRebufferedAudio(const media::AudioBus& audio_bus,
int frame_delay);
- // Removes this object from a blink::WebMediaStreamSource with which it
- // might be registered. The goal is to avoid dangling pointers.
- void removeFromBlinkSource();
+ // Deregisters this object from its blink::WebMediaStreamSource.
+ void DeregisterFromBlinkSource();
// Used to DCHECK that some methods are called on the correct thread.
base::ThreadChecker thread_checker_;
// The audio track this WebAudioCapturerSource is feeding data to.
- // WebRtcLocalAudioTrack is reference counted, and owning this object.
- // To avoid circular reference, a raw pointer is kept here.
WebRtcLocalAudioTrack* track_;
media::AudioParameters params_;
« no previous file with comments | « content/renderer/media/user_media_client_impl_unittest.cc ('k') | content/renderer/media/webaudio_capturer_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698