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_BASE_AUDIO_RENDERER_SINK_H_ | 5 #ifndef MEDIA_BASE_AUDIO_RENDERER_SINK_H_ |
6 #define MEDIA_BASE_AUDIO_RENDERER_SINK_H_ | 6 #define MEDIA_BASE_AUDIO_RENDERER_SINK_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 17 matching lines...) Expand all Loading... |
28 // AudioRendererSink is an interface representing the end-point for | 28 // AudioRendererSink is an interface representing the end-point for |
29 // rendered audio. An implementation is expected to | 29 // rendered audio. An implementation is expected to |
30 // periodically call Render() on a callback object. | 30 // periodically call Render() on a callback object. |
31 | 31 |
32 class AudioRendererSink | 32 class AudioRendererSink |
33 : public base::RefCountedThreadSafe<media::AudioRendererSink> { | 33 : public base::RefCountedThreadSafe<media::AudioRendererSink> { |
34 public: | 34 public: |
35 class RenderCallback { | 35 class RenderCallback { |
36 public: | 36 public: |
37 // Attempts to completely fill all channels of |dest|, returns actual | 37 // Attempts to completely fill all channels of |dest|, returns actual |
38 // number of frames filled. | 38 // number of frames filled. |frames_skipped| contains the number of frames |
39 virtual int Render(AudioBus* dest, int audio_delay_milliseconds) = 0; | 39 // the consumer has skipped, if any. |
| 40 virtual int Render(AudioBus* dest, |
| 41 uint32_t audio_delay_milliseconds, |
| 42 uint32_t frames_skipped) = 0; |
40 | 43 |
41 // Signals an error has occurred. | 44 // Signals an error has occurred. |
42 virtual void OnRenderError() = 0; | 45 virtual void OnRenderError() = 0; |
43 | 46 |
44 protected: | 47 protected: |
45 virtual ~RenderCallback() {} | 48 virtual ~RenderCallback() {} |
46 }; | 49 }; |
47 | 50 |
48 // Sets important information about the audio stream format. | 51 // Sets important information about the audio stream format. |
49 // It must be called before any of the other methods. | 52 // It must be called before any of the other methods. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
85 // this. | 88 // this. |
86 | 89 |
87 class RestartableAudioRendererSink : public AudioRendererSink { | 90 class RestartableAudioRendererSink : public AudioRendererSink { |
88 protected: | 91 protected: |
89 ~RestartableAudioRendererSink() override {} | 92 ~RestartableAudioRendererSink() override {} |
90 }; | 93 }; |
91 | 94 |
92 } // namespace media | 95 } // namespace media |
93 | 96 |
94 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ | 97 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ |
OLD | NEW |