| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 MEDIA_AUDIO_AUDIO_IO_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_IO_H_ |
| 6 #define MEDIA_AUDIO_AUDIO_IO_H_ | 6 #define MEDIA_AUDIO_AUDIO_IO_H_ |
| 7 | 7 |
| 8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
| 9 #include "media/audio/audio_buffers_state.h" | 9 #include "media/audio/audio_buffers_state.h" |
| 10 #include "media/base/audio_bus.h" | 10 #include "media/base/audio_bus.h" |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 51 | 51 |
| 52 class MEDIA_EXPORT AudioOutputStream { | 52 class MEDIA_EXPORT AudioOutputStream { |
| 53 public: | 53 public: |
| 54 // Audio sources must implement AudioSourceCallback. This interface will be | 54 // Audio sources must implement AudioSourceCallback. This interface will be |
| 55 // called in a random thread which very likely is a high priority thread. Do | 55 // called in a random thread which very likely is a high priority thread. Do |
| 56 // not rely on using this thread TLS or make calls that alter the thread | 56 // not rely on using this thread TLS or make calls that alter the thread |
| 57 // itself such as creating Windows or initializing COM. | 57 // itself such as creating Windows or initializing COM. |
| 58 class MEDIA_EXPORT AudioSourceCallback { | 58 class MEDIA_EXPORT AudioSourceCallback { |
| 59 public: | 59 public: |
| 60 // Provide more data by fully filling |dest|. The source will return | 60 // Provide more data by fully filling |dest|. The source will return |
| 61 // the number of frames it filled. |buffers_state| contains current state | 61 // the number of frames it filled. |total_bytes_delay| contains current |
| 62 // of the buffers, and can be used by the source to calculate delay. | 62 // number of bytes of delay buffered by the AudioOutputStream. |
| 63 virtual int OnMoreData(AudioBus* dest, | 63 // |
| 64 AudioBuffersState buffers_state) = 0; | 64 // TODO(acolwell): Remove default implementation of this method once |
| 65 // the AudioBuffersState version below is removed. |
| 66 virtual int OnMoreData(AudioBus* dest, int total_bytes_delay); |
| 67 |
| 68 // TODO(acolwell): Remove this once all dependencies on AudioBufferState |
| 69 // that are outside the main Chromium repository have been removed. |
| 70 virtual int OnMoreData(AudioBus* dest, AudioBuffersState buffers_state); |
| 65 | 71 |
| 66 // There was an error while playing a buffer. Audio source cannot be | 72 // There was an error while playing a buffer. Audio source cannot be |
| 67 // destroyed yet. No direct action needed by the AudioStream, but it is | 73 // destroyed yet. No direct action needed by the AudioStream, but it is |
| 68 // a good place to stop accumulating sound data since is is likely that | 74 // a good place to stop accumulating sound data since is is likely that |
| 69 // playback will not continue. | 75 // playback will not continue. |
| 70 virtual void OnError(AudioOutputStream* stream) = 0; | 76 virtual void OnError(AudioOutputStream* stream) = 0; |
| 71 | 77 |
| 72 protected: | 78 protected: |
| 73 virtual ~AudioSourceCallback() {} | 79 virtual ~AudioSourceCallback() {} |
| 74 }; | 80 }; |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 164 // Sets the Automatic Gain Control (AGC) state. | 170 // Sets the Automatic Gain Control (AGC) state. |
| 165 virtual void SetAutomaticGainControl(bool enabled) = 0; | 171 virtual void SetAutomaticGainControl(bool enabled) = 0; |
| 166 | 172 |
| 167 // Returns the Automatic Gain Control (AGC) state. | 173 // Returns the Automatic Gain Control (AGC) state. |
| 168 virtual bool GetAutomaticGainControl() = 0; | 174 virtual bool GetAutomaticGainControl() = 0; |
| 169 }; | 175 }; |
| 170 | 176 |
| 171 } // namespace media | 177 } // namespace media |
| 172 | 178 |
| 173 #endif // MEDIA_AUDIO_AUDIO_IO_H_ | 179 #endif // MEDIA_AUDIO_AUDIO_IO_H_ |
| OLD | NEW |