| OLD | NEW |
| (Empty) | |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_SOURCE_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_SOURCE_H_ |
| 7 |
| 8 #include "base/compiler_specific.h" |
| 9 #include "content/common/content_export.h" |
| 10 #include "content/renderer/media/media_stream_dependency_factory.h" |
| 11 #include "content/renderer/media/media_stream_source.h" |
| 12 #include "content/renderer/media/webrtc_audio_capturer.h" |
| 13 #include "third_party/libjingle/source/talk/app/webrtc/mediastreaminterface.h" |
| 14 |
| 15 namespace content { |
| 16 |
| 17 class CONTENT_EXPORT MediaStreamAudioSource |
| 18 : NON_EXPORTED_BASE(public MediaStreamSource) { |
| 19 public: |
| 20 MediaStreamAudioSource(int render_view_id, |
| 21 const StreamDeviceInfo& device_info, |
| 22 const SourceStoppedCallback& stop_callback, |
| 23 MediaStreamDependencyFactory* factory); |
| 24 MediaStreamAudioSource(); |
| 25 virtual ~MediaStreamAudioSource(); |
| 26 |
| 27 virtual void AddTrack(const blink::WebMediaStreamTrack& track, |
| 28 const blink::WebMediaConstraints& constraints, |
| 29 const ConstraintsCallback& callback) OVERRIDE; |
| 30 virtual void RemoveTrack(const blink::WebMediaStreamTrack& track) OVERRIDE; |
| 31 |
| 32 void SetLocalAudioSource(webrtc::AudioSourceInterface* source) { |
| 33 local_audio_source_ = source; |
| 34 } |
| 35 |
| 36 void SetAudioCapturer(WebRtcAudioCapturer* capturer) { |
| 37 DCHECK(!audio_capturer_); |
| 38 audio_capturer_ = capturer; |
| 39 } |
| 40 |
| 41 const scoped_refptr<WebRtcAudioCapturer>& GetAudioCapturer() { |
| 42 return audio_capturer_; |
| 43 } |
| 44 |
| 45 webrtc::AudioSourceInterface* local_audio_source() { |
| 46 return local_audio_source_.get(); |
| 47 } |
| 48 |
| 49 protected: |
| 50 virtual void DoStopSource() OVERRIDE; |
| 51 |
| 52 private: |
| 53 int render_view_id_; // Render view ID that created this source. |
| 54 // This member holds an instance of webrtc::LocalAudioSource. This is used |
| 55 // as a container for audio options. |
| 56 scoped_refptr<webrtc::AudioSourceInterface> local_audio_source_; |
| 57 |
| 58 scoped_refptr<WebRtcAudioCapturer> audio_capturer_; |
| 59 |
| 60 MediaStreamDependencyFactory* factory_; |
| 61 |
| 62 DISALLOW_COPY_AND_ASSIGN(MediaStreamAudioSource); |
| 63 }; |
| 64 |
| 65 } // namespace content |
| 66 |
| 67 #endif // CONTENT_RENDERER_MEDIA_MEDIA_STREAM_AUDIO_SOURCE_H_ |
| OLD | NEW |