| 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 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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 virtual ~WebRtcLocalAudioSourceProvider(); |
| 54 | 54 |
| 55 // MediaStreamAudioSink implementation. | 55 // MediaStreamAudioSink implementation. |
| 56 virtual void OnData(const int16* audio_data, | 56 virtual void OnData(const int16* audio_data, |
| 57 int sample_rate, | 57 int sample_rate, |
| 58 int number_of_channels, | 58 int number_of_channels, |
| 59 int number_of_frames) OVERRIDE; | 59 int number_of_frames) override; |
| 60 virtual void OnSetFormat(const media::AudioParameters& params) OVERRIDE; | 60 virtual void OnSetFormat(const media::AudioParameters& params) override; |
| 61 virtual void OnReadyStateChanged( | 61 virtual void OnReadyStateChanged( |
| 62 blink::WebMediaStreamSource::ReadyState state) OVERRIDE; | 62 blink::WebMediaStreamSource::ReadyState state) override; |
| 63 | 63 |
| 64 // blink::WebAudioSourceProvider implementation. | 64 // blink::WebAudioSourceProvider implementation. |
| 65 virtual void setClient(blink::WebAudioSourceProviderClient* client) OVERRIDE; | 65 virtual void setClient(blink::WebAudioSourceProviderClient* client) override; |
| 66 virtual void provideInput(const blink::WebVector<float*>& audio_data, | 66 virtual void provideInput(const blink::WebVector<float*>& audio_data, |
| 67 size_t number_of_frames) OVERRIDE; | 67 size_t number_of_frames) override; |
| 68 | 68 |
| 69 // media::AudioConverter::Inputcallback implementation. | 69 // media::AudioConverter::Inputcallback implementation. |
| 70 // This function is triggered by provideInput()on the WebAudio audio thread, | 70 // This function is triggered by provideInput()on the WebAudio audio thread, |
| 71 // so it has been under the protection of |lock_|. | 71 // so it has been under the protection of |lock_|. |
| 72 virtual double ProvideInput(media::AudioBus* audio_bus, | 72 virtual double ProvideInput(media::AudioBus* audio_bus, |
| 73 base::TimeDelta buffer_delay) OVERRIDE; | 73 base::TimeDelta buffer_delay) override; |
| 74 | 74 |
| 75 // Method to allow the unittests to inject its own sink parameters to avoid | 75 // Method to allow the unittests to inject its own sink parameters to avoid |
| 76 // query the hardware. | 76 // query the hardware. |
| 77 // TODO(xians,tommi): Remove and instead offer a way to inject the sink | 77 // TODO(xians,tommi): Remove and instead offer a way to inject the sink |
| 78 // parameters so that the implementation doesn't rely on the global default | 78 // parameters so that the implementation doesn't rely on the global default |
| 79 // hardware config but instead gets the parameters directly from the sink | 79 // hardware config but instead gets the parameters directly from the sink |
| 80 // (WebAudio in this case). Ideally the unit test should be able to use that | 80 // (WebAudio in this case). Ideally the unit test should be able to use that |
| 81 // same mechanism to inject the sink parameters for testing. | 81 // same mechanism to inject the sink parameters for testing. |
| 82 void SetSinkParamsForTesting(const media::AudioParameters& sink_params); | 82 void SetSinkParamsForTesting(const media::AudioParameters& sink_params); |
| 83 | 83 |
| (...skipping 20 matching lines...) Expand all Loading... |
| 104 | 104 |
| 105 // Flag to tell if the track has been stopped or not. | 105 // Flag to tell if the track has been stopped or not. |
| 106 bool track_stopped_; | 106 bool track_stopped_; |
| 107 | 107 |
| 108 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioSourceProvider); | 108 DISALLOW_COPY_AND_ASSIGN(WebRtcLocalAudioSourceProvider); |
| 109 }; | 109 }; |
| 110 | 110 |
| 111 } // namespace content | 111 } // namespace content |
| 112 | 112 |
| 113 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_SOURCE_PROVIDER_H_ | 113 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_LOCAL_AUDIO_SOURCE_PROVIDER_H_ |
| OLD | NEW |