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 <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
(...skipping 10 matching lines...) Expand all Loading... |
21 // AudioRendererSink is an interface representing the end-point for | 21 // AudioRendererSink is an interface representing the end-point for |
22 // rendered audio. An implementation is expected to | 22 // rendered audio. An implementation is expected to |
23 // periodically call Render() on a callback object. | 23 // periodically call Render() on a callback object. |
24 | 24 |
25 class AudioRendererSink | 25 class AudioRendererSink |
26 : public base::RefCountedThreadSafe<media::AudioRendererSink> { | 26 : public base::RefCountedThreadSafe<media::AudioRendererSink> { |
27 public: | 27 public: |
28 class RenderCallback { | 28 class RenderCallback { |
29 public: | 29 public: |
30 // Attempts to completely fill all channels of |dest|, returns actual | 30 // Attempts to completely fill all channels of |dest|, returns actual |
31 // number of frames filled. |prior_frames_skipped| contains the number of | 31 // number of frames filled. |frames_skipped| contains the number of frames |
32 // frames | |
33 // the consumer has skipped, if any. | 32 // the consumer has skipped, if any. |
34 // The |delay| argument represents audio device output latency, | 33 // TODO(jameswest): Change to use the same signature as |
35 // |delay_timestamp| represents the time when |delay| was obtained. | 34 // AudioOutputStream::AudioSourceCallback::OnMoreData. |
36 virtual int Render(base::TimeDelta delay, | 35 virtual int Render(AudioBus* dest, |
37 base::TimeTicks delay_timestamp, | 36 uint32_t frames_delayed, |
38 int prior_frames_skipped, | 37 uint32_t frames_skipped) = 0; |
39 AudioBus* dest) = 0; | 38 |
40 // Signals an error has occurred. | 39 // Signals an error has occurred. |
41 virtual void OnRenderError() = 0; | 40 virtual void OnRenderError() = 0; |
42 | 41 |
43 protected: | 42 protected: |
44 virtual ~RenderCallback() {} | 43 virtual ~RenderCallback() {} |
45 }; | 44 }; |
46 | 45 |
47 // Sets important information about the audio stream format. | 46 // Sets important information about the audio stream format. |
48 // It must be called before any of the other methods. | 47 // It must be called before any of the other methods. |
49 virtual void Initialize(const AudioParameters& params, | 48 virtual void Initialize(const AudioParameters& params, |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 const url::Origin& security_origin, | 103 const url::Origin& security_origin, |
105 const OutputDeviceStatusCB& callback) = 0; | 104 const OutputDeviceStatusCB& callback) = 0; |
106 | 105 |
107 protected: | 106 protected: |
108 ~SwitchableAudioRendererSink() override {} | 107 ~SwitchableAudioRendererSink() override {} |
109 }; | 108 }; |
110 | 109 |
111 } // namespace media | 110 } // namespace media |
112 | 111 |
113 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ | 112 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ |
OLD | NEW |