OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_SILENT_SINK_SUSPENDER_H_ | 5 #ifndef MEDIA_BASE_SILENT_SINK_SUSPENDER_H_ |
6 #define MEDIA_BASE_SILENT_SINK_SUSPENDER_H_ | 6 #define MEDIA_BASE_SILENT_SINK_SUSPENDER_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <deque> | 10 #include <deque> |
(...skipping 29 matching lines...) Expand all Loading... |
40 // amount of silence to allow before suspension is |silence_timeout|. | 40 // amount of silence to allow before suspension is |silence_timeout|. |
41 SilentSinkSuspender( | 41 SilentSinkSuspender( |
42 AudioRendererSink::RenderCallback* callback, | 42 AudioRendererSink::RenderCallback* callback, |
43 base::TimeDelta silence_timeout, | 43 base::TimeDelta silence_timeout, |
44 const AudioParameters& params, | 44 const AudioParameters& params, |
45 const scoped_refptr<AudioRendererSink>& sink, | 45 const scoped_refptr<AudioRendererSink>& sink, |
46 const scoped_refptr<base::SingleThreadTaskRunner>& worker); | 46 const scoped_refptr<base::SingleThreadTaskRunner>& worker); |
47 ~SilentSinkSuspender() override; | 47 ~SilentSinkSuspender() override; |
48 | 48 |
49 // AudioRendererSink::RenderCallback implementation. | 49 // AudioRendererSink::RenderCallback implementation. |
50 int Render(AudioBus* dest, | 50 int Render(base::TimeDelta delay, |
51 uint32_t frames_delayed, | 51 base::TimeTicks delay_timestamp, |
52 uint32_t frames_skipped) override; | 52 int prior_frames_skipped, |
| 53 AudioBus* dest) override; |
53 void OnRenderError() override; | 54 void OnRenderError() override; |
54 | 55 |
55 bool is_using_fake_sink_for_testing() const { return is_using_fake_sink_; } | 56 bool is_using_fake_sink_for_testing() const { return is_using_fake_sink_; } |
56 | 57 |
57 private: | 58 private: |
58 // If |use_fake_sink| is true, pauses |sink_| and plays |fake_sink_|; if | 59 // If |use_fake_sink| is true, pauses |sink_| and plays |fake_sink_|; if |
59 // false, pauses |fake_sink_| and plays |sink_|. | 60 // false, pauses |fake_sink_| and plays |sink_|. |
60 void TransitionSinks(bool use_fake_sink); | 61 void TransitionSinks(bool use_fake_sink); |
61 | 62 |
62 // Actual RenderCallback providing audio data to the output device. | 63 // Actual RenderCallback providing audio data to the output device. |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // after a period of silence or first non-silent audio respective. We do this | 102 // after a period of silence or first non-silent audio respective. We do this |
102 // on Android to save battery consumption. | 103 // on Android to save battery consumption. |
103 base::CancelableCallback<void(bool)> sink_transition_callback_; | 104 base::CancelableCallback<void(bool)> sink_transition_callback_; |
104 | 105 |
105 DISALLOW_COPY_AND_ASSIGN(SilentSinkSuspender); | 106 DISALLOW_COPY_AND_ASSIGN(SilentSinkSuspender); |
106 }; | 107 }; |
107 | 108 |
108 } // namespace content | 109 } // namespace content |
109 | 110 |
110 #endif // MEDIA_BASE_SILENT_SINK_SUSPENDER_H_ | 111 #endif // MEDIA_BASE_SILENT_SINK_SUSPENDER_H_ |
OLD | NEW |