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. |frames_skipped| contains the number of frames | 38 // number of frames filled. |
39 // the consumer has skipped, if any. | 39 virtual int Render(AudioBus* dest, int audio_delay_milliseconds) = 0; |
40 virtual int Render(AudioBus* dest, | |
41 uint32_t audio_delay_milliseconds, | |
42 uint32_t frames_skipped) = 0; | |
43 | 40 |
44 // Signals an error has occurred. | 41 // Signals an error has occurred. |
45 virtual void OnRenderError() = 0; | 42 virtual void OnRenderError() = 0; |
46 | 43 |
47 protected: | 44 protected: |
48 virtual ~RenderCallback() {} | 45 virtual ~RenderCallback() {} |
49 }; | 46 }; |
50 | 47 |
51 // Sets important information about the audio stream format. | 48 // Sets important information about the audio stream format. |
52 // It must be called before any of the other methods. | 49 // It must be called before any of the other methods. |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
88 // this. | 85 // this. |
89 | 86 |
90 class RestartableAudioRendererSink : public AudioRendererSink { | 87 class RestartableAudioRendererSink : public AudioRendererSink { |
91 protected: | 88 protected: |
92 ~RestartableAudioRendererSink() override {} | 89 ~RestartableAudioRendererSink() override {} |
93 }; | 90 }; |
94 | 91 |
95 } // namespace media | 92 } // namespace media |
96 | 93 |
97 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ | 94 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ |
OLD | NEW |