| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_SOURCE_PROVIDER_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_SOURCE_PROVIDER_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_SOURCE_PROVIDER_H_ | 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_SOURCE_PROVIDER_H_ |
| 7 | 7 |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 43 // All calls are protected by a lock. | 43 // All calls are protected by a lock. |
| 44 class CONTENT_EXPORT WebRtcLocalAudioSourceProvider | 44 class CONTENT_EXPORT WebRtcLocalAudioSourceProvider |
| 45 : NON_EXPORTED_BASE(public blink::WebAudioSourceProvider), | 45 : NON_EXPORTED_BASE(public blink::WebAudioSourceProvider), |
| 46 NON_EXPORTED_BASE(public media::AudioConverter::InputCallback), | 46 NON_EXPORTED_BASE(public media::AudioConverter::InputCallback), |
| 47 NON_EXPORTED_BASE(public MediaStreamAudioSink) { | 47 NON_EXPORTED_BASE(public MediaStreamAudioSink) { |
| 48 public: | 48 public: |
| 49 static const size_t kWebAudioRenderBufferSize; | 49 static const size_t kWebAudioRenderBufferSize; |
| 50 | 50 |
| 51 explicit WebRtcLocalAudioSourceProvider( | 51 explicit WebRtcLocalAudioSourceProvider( |
| 52 const blink::WebMediaStreamTrack& track); | 52 const blink::WebMediaStreamTrack& track); |
| 53 virtual ~WebRtcLocalAudioSourceProvider(); | 53 ~WebRtcLocalAudioSourceProvider() override; |
| 54 | 54 |
| 55 // MediaStreamAudioSink implementation. | 55 // MediaStreamAudioSink implementation. |
| 56 void OnData(const media::AudioBus& audio_bus, | 56 void OnData(const media::AudioBus& audio_bus, |
| 57 base::TimeTicks estimated_capture_time) override; | 57 base::TimeTicks estimated_capture_time) override; |
| 58 void OnSetFormat(const media::AudioParameters& params) override; | 58 void OnSetFormat(const media::AudioParameters& params) override; |
| 59 void OnReadyStateChanged( | 59 void OnReadyStateChanged( |
| 60 blink::WebMediaStreamSource::ReadyState state) override; | 60 blink::WebMediaStreamSource::ReadyState state) override; |
| 61 | 61 |
| 62 // blink::WebAudioSourceProvider implementation. | 62 // blink::WebAudioSourceProvider implementation. |
| 63 virtual void setClient(blink::WebAudioSourceProviderClient* client) override; | 63 void setClient(blink::WebAudioSourceProviderClient* client) override; |
| 64 virtual void provideInput(const blink::WebVector<float*>& audio_data, | 64 void provideInput(const blink::WebVector<float*>& audio_data, |
| 65 size_t number_of_frames) override; | 65 size_t number_of_frames) override; |
| 66 | 66 |
| 67 // media::AudioConverter::Inputcallback implementation. | 67 // media::AudioConverter::Inputcallback implementation. |
| 68 // This function is triggered by provideInput()on the WebAudio audio thread, | 68 // This function is triggered by provideInput()on the WebAudio audio thread, |
| 69 // so it has been under the protection of |lock_|. | 69 // so it has been under the protection of |lock_|. |
| 70 double ProvideInput(media::AudioBus* audio_bus, | 70 double ProvideInput(media::AudioBus* audio_bus, |
| 71 base::TimeDelta buffer_delay) override; | 71 base::TimeDelta buffer_delay) override; |
| 72 | 72 |
| 73 // Method to allow the unittests to inject its own sink parameters to avoid | 73 // Method to allow the unittests to inject its own sink parameters to avoid |
| 74 // query the hardware. | 74 // query the hardware. |
| 75 // TODO(xians,tommi): Remove and instead offer a way to inject the sink | 75 // TODO(xians,tommi): Remove and instead offer a way to inject the sink |
| (...skipping 25 matching lines...) Expand all Loading... |
| 101 | 101 |
| 102 // Flag to tell if the track has been stopped or not. | 102 // Flag to tell if the track has been stopped or not. |
| 103 bool track_stopped_; | 103 bool track_stopped_; |
| 104 | 104 |
| 105 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioSourceProvider); | 105 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioSourceProvider); |
| 106 }; | 106 }; |
| 107 | 107 |
| 108 } // namespace content | 108 } // namespace content |
| 109 | 109 |
| 110 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_SOURCE_PROVIDER_H_ | 110 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_SOURCE_PROVIDER_H_ |
| OLD | NEW |