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

Unified Diff: content/renderer/media/media_stream_audio_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: addressed o1ka's comments Created 4 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
Index: content/renderer/media/media_stream_audio_source.h
diff --git a/content/renderer/media/media_stream_audio_source.h b/content/renderer/media/media_stream_audio_source.h
index b2f44d2b44d3e582cdbae3da775cff0b292716b8..04dacbd588a2047b70f158ee67555747e4d41902 100644
--- a/content/renderer/media/media_stream_audio_source.h
+++ b/content/renderer/media/media_stream_audio_source.h
@@ -7,6 +7,7 @@
#include "base/compiler_specific.h"
#include "base/macros.h"
+#include "base/memory/scoped_ptr.h"
#include "content/common/content_export.h"
#include "content/renderer/media/media_stream_source.h"
#include "content/renderer/media/webrtc/peer_connection_dependency_factory.h"
@@ -15,6 +16,10 @@
namespace content {
+// TODO(miu): In a soon-upcoming set of refactoring changes, this class will
+// become a base class for managing tracks (part of what WebRtcAudioCapturer
+// does today). Then, the rest of WebRtcAudioCapturer will be rolled into a
+// subclass. http://crbug.com/577874
class CONTENT_EXPORT MediaStreamAudioSource
: NON_EXPORTED_BASE(public MediaStreamSource) {
public:
@@ -25,27 +30,29 @@ class CONTENT_EXPORT MediaStreamAudioSource
MediaStreamAudioSource();
~MediaStreamAudioSource() override;
+ // Returns the MediaStreamAudioSource instance owned by the given blink
+ // |source| or null.
+ static MediaStreamAudioSource* From(const blink::WebMediaStreamSource& track);
+
void AddTrack(const blink::WebMediaStreamTrack& track,
const blink::WebMediaConstraints& constraints,
const ConstraintsCallback& callback);
- void SetLocalAudioSource(webrtc::AudioSourceInterface* source) {
- local_audio_source_ = source;
- }
+ WebRtcAudioCapturer* audio_capturer() const { return audio_capturer_.get(); }
- void SetAudioCapturer(const scoped_refptr<WebRtcAudioCapturer>& capturer) {
+ void SetAudioCapturer(scoped_ptr<WebRtcAudioCapturer> capturer) {
DCHECK(!audio_capturer_.get());
- audio_capturer_ = capturer;
- }
-
- const scoped_refptr<WebRtcAudioCapturer>& GetAudioCapturer() {
- return audio_capturer_;
+ audio_capturer_ = std::move(capturer);
}
webrtc::AudioSourceInterface* local_audio_source() {
return local_audio_source_.get();
}
+ void SetLocalAudioSource(scoped_refptr<webrtc::AudioSourceInterface> source) {
+ local_audio_source_ = source;
+ }
+
protected:
void DoStopSource() override;
@@ -53,12 +60,12 @@ class CONTENT_EXPORT MediaStreamAudioSource
const int render_frame_id_;
PeerConnectionDependencyFactory* const factory_;
+ scoped_ptr<WebRtcAudioCapturer> audio_capturer_;
+
// This member holds an instance of webrtc::LocalAudioSource. This is used
// as a container for audio options.
scoped_refptr<webrtc::AudioSourceInterface> local_audio_source_;
- scoped_refptr<WebRtcAudioCapturer> audio_capturer_;
-
DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioSource);
};

Powered by Google App Engine
This is Rietveld 408576698