| 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. |frames_skipped| contains the number of frames | 31 // number of frames filled. |prior_frames_skipped| contains the number of |
| 32 // frames |
| 32 // the consumer has skipped, if any. | 33 // the consumer has skipped, if any. |
| 33 // TODO(jameswest): Change to use the same signature as | 34 // The |delay| argument represents audio device output latency, |
| 34 // AudioOutputStream::AudioSourceCallback::OnMoreData. | 35 // |delay_timestamp| represents the time when |delay| was obtained. |
| 35 virtual int Render(AudioBus* dest, | 36 virtual int Render(base::TimeDelta delay, |
| 36 uint32_t frames_delayed, | 37 base::TimeTicks delay_timestamp, |
| 37 uint32_t frames_skipped) = 0; | 38 int prior_frames_skipped, |
| 38 | 39 AudioBus* dest) = 0; |
| 39 // Signals an error has occurred. | 40 // Signals an error has occurred. |
| 40 virtual void OnRenderError() = 0; | 41 virtual void OnRenderError() = 0; |
| 41 | 42 |
| 42 protected: | 43 protected: |
| 43 virtual ~RenderCallback() {} | 44 virtual ~RenderCallback() {} |
| 44 }; | 45 }; |
| 45 | 46 |
| 46 // Sets important information about the audio stream format. | 47 // Sets important information about the audio stream format. |
| 47 // It must be called before any of the other methods. | 48 // It must be called before any of the other methods. |
| 48 virtual void Initialize(const AudioParameters& params, | 49 virtual void Initialize(const AudioParameters& params, |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 103 const url::Origin& security_origin, | 104 const url::Origin& security_origin, |
| 104 const OutputDeviceStatusCB& callback) = 0; | 105 const OutputDeviceStatusCB& callback) = 0; |
| 105 | 106 |
| 106 protected: | 107 protected: |
| 107 ~SwitchableAudioRendererSink() override {} | 108 ~SwitchableAudioRendererSink() override {} |
| 108 }; | 109 }; |
| 109 | 110 |
| 110 } // namespace media | 111 } // namespace media |
| 111 | 112 |
| 112 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ | 113 #endif // MEDIA_BASE_AUDIO_RENDERER_SINK_H_ |
| OLD | NEW |