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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
67 AudioBus* dest, | 67 AudioBus* dest, |
68 AudioBuffersState buffers_state) = 0; | 68 AudioBuffersState buffers_state) = 0; |
69 | 69 |
70 // There was an error while playing a buffer. Audio source cannot be | 70 // There was an error while playing a buffer. Audio source cannot be |
71 // destroyed yet. No direct action needed by the AudioStream, but it is | 71 // destroyed yet. No direct action needed by the AudioStream, but it is |
72 // a good place to stop accumulating sound data since is is likely that | 72 // a good place to stop accumulating sound data since is is likely that |
73 // playback will not continue. |code| is an error code that is platform | 73 // playback will not continue. |code| is an error code that is platform |
74 // specific. | 74 // specific. |
75 virtual void OnError(AudioOutputStream* stream, int code) = 0; | 75 virtual void OnError(AudioOutputStream* stream, int code) = 0; |
76 | 76 |
77 // Waits till data becomes available. Used when buffering data starting | 77 // Deprecated. DO NOT USE. Waits until data becomes available. Used only |
78 // new audio stream. | 78 // by Windows' WaveOut clients which may be extremely laggy. Will yield the |
79 // Polling is not the best approach, but incorporating messaging loop | 79 // current thread until the renderer client has written its audio data or |
80 // with delayed tasks into guts of complex code is even worse, as it is | 80 // 1.5 seconds have elapsed. |
81 // very error-prone. We cannot easily add synchronization, interface is | |
82 // already cut in stone because of need of backward compatibility with | |
83 // plugins. In any case, data is usually immediately available, | |
84 // so there would be no delay. | |
85 virtual void WaitTillDataReady() {} | 81 virtual void WaitTillDataReady() {} |
86 | 82 |
87 protected: | 83 protected: |
88 virtual ~AudioSourceCallback() {} | 84 virtual ~AudioSourceCallback() {} |
89 }; | 85 }; |
90 | 86 |
91 virtual ~AudioOutputStream() {} | 87 virtual ~AudioOutputStream() {} |
92 | 88 |
93 // Open the stream. false is returned if the stream cannot be opened. | 89 // Open the stream. false is returned if the stream cannot be opened. |
94 virtual bool Open() = 0; | 90 virtual bool Open() = 0; |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
174 // Sets the Automatic Gain Control (AGC) state. | 170 // Sets the Automatic Gain Control (AGC) state. |
175 virtual void SetAutomaticGainControl(bool enabled) = 0; | 171 virtual void SetAutomaticGainControl(bool enabled) = 0; |
176 | 172 |
177 // Returns the Automatic Gain Control (AGC) state. | 173 // Returns the Automatic Gain Control (AGC) state. |
178 virtual bool GetAutomaticGainControl() = 0; | 174 virtual bool GetAutomaticGainControl() = 0; |
179 }; | 175 }; |
180 | 176 |
181 } // namespace media | 177 } // namespace media |
182 | 178 |
183 #endif // MEDIA_AUDIO_AUDIO_IO_H_ | 179 #endif // MEDIA_AUDIO_AUDIO_IO_H_ |
OLD | NEW |