OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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_AUDIO_CLOCKLESS_AUDIO_SINK_H_ | 5 #ifndef MEDIA_AUDIO_CLOCKLESS_AUDIO_SINK_H_ |
6 #define MEDIA_AUDIO_CLOCKLESS_AUDIO_SINK_H_ | 6 #define MEDIA_AUDIO_CLOCKLESS_AUDIO_SINK_H_ |
7 | 7 |
8 #include <memory> | 8 #include <memory> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 19 matching lines...) Expand all Loading... |
30 | 30 |
31 // AudioRendererSink implementation. | 31 // AudioRendererSink implementation. |
32 void Initialize(const AudioParameters& params, | 32 void Initialize(const AudioParameters& params, |
33 RenderCallback* callback) override; | 33 RenderCallback* callback) override; |
34 void Start() override; | 34 void Start() override; |
35 void Stop() override; | 35 void Stop() override; |
36 void Pause() override; | 36 void Pause() override; |
37 void Play() override; | 37 void Play() override; |
38 bool SetVolume(double volume) override; | 38 bool SetVolume(double volume) override; |
39 OutputDeviceInfo GetOutputDeviceInfo() override; | 39 OutputDeviceInfo GetOutputDeviceInfo() override; |
| 40 bool BelongsToRenderingThread() override; |
40 | 41 |
41 // Returns the time taken to consume all the audio. | 42 // Returns the time taken to consume all the audio. |
42 base::TimeDelta render_time() { return playback_time_; } | 43 base::TimeDelta render_time() { return playback_time_; } |
43 | 44 |
44 // Enables audio frame hashing. Must be called prior to Initialize(). | 45 // Enables audio frame hashing. Must be called prior to Initialize(). |
45 void StartAudioHashForTesting(); | 46 void StartAudioHashForTesting(); |
46 | 47 |
47 // Returns the hash of all audio frames seen since construction. | 48 // Returns the hash of all audio frames seen since construction. |
48 std::string GetAudioHashForTesting(); | 49 std::string GetAudioHashForTesting(); |
49 | 50 |
50 protected: | 51 protected: |
51 ~ClocklessAudioSink() override; | 52 ~ClocklessAudioSink() override; |
52 | 53 |
53 private: | 54 private: |
54 const OutputDeviceInfo device_info_; | 55 const OutputDeviceInfo device_info_; |
55 std::unique_ptr<ClocklessAudioSinkThread> thread_; | 56 std::unique_ptr<ClocklessAudioSinkThread> thread_; |
56 bool initialized_; | 57 bool initialized_; |
57 bool playing_; | 58 bool playing_; |
58 bool hashing_; | 59 bool hashing_; |
59 | 60 |
60 // Time taken in last set of Render() calls. | 61 // Time taken in last set of Render() calls. |
61 base::TimeDelta playback_time_; | 62 base::TimeDelta playback_time_; |
62 | 63 |
63 DISALLOW_COPY_AND_ASSIGN(ClocklessAudioSink); | 64 DISALLOW_COPY_AND_ASSIGN(ClocklessAudioSink); |
64 }; | 65 }; |
65 | 66 |
66 } // namespace media | 67 } // namespace media |
67 | 68 |
68 #endif // MEDIA_AUDIO_CLOCKLESS_AUDIO_SINK_H_ | 69 #endif // MEDIA_AUDIO_CLOCKLESS_AUDIO_SINK_H_ |
OLD | NEW |