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); |
}; |