OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_AUDIO_OUTPUT_STREAM_SINK_H_ | 5 #ifndef MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_SINK_H_ |
6 #define MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_SINK_H_ | 6 #define MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_SINK_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <string> | 10 #include <string> |
11 | 11 |
12 #include "base/compiler_specific.h" | 12 #include "base/compiler_specific.h" |
13 #include "base/macros.h" | 13 #include "base/macros.h" |
14 #include "base/single_thread_task_runner.h" | 14 #include "base/single_thread_task_runner.h" |
15 #include "base/synchronization/lock.h" | 15 #include "base/synchronization/lock.h" |
| 16 #include "base/time/time.h" |
16 #include "media/audio/audio_io.h" | 17 #include "media/audio/audio_io.h" |
17 #include "media/base/audio_renderer_sink.h" | 18 #include "media/base/audio_renderer_sink.h" |
18 #include "media/base/media_export.h" | 19 #include "media/base/media_export.h" |
19 | 20 |
20 namespace media { | 21 namespace media { |
21 | 22 |
22 // Wrapper which exposes the browser side audio interface (AudioOutputStream) as | 23 // Wrapper which exposes the browser side audio interface (AudioOutputStream) as |
23 // if it were a renderer side audio interface (AudioRendererSink). Note: This | 24 // if it were a renderer side audio interface (AudioRendererSink). Note: This |
24 // will not work for sandboxed renderers. | 25 // will not work for sandboxed renderers. |
25 // | 26 // |
(...skipping 10 matching lines...) Expand all Loading... |
36 RenderCallback* callback) override; | 37 RenderCallback* callback) override; |
37 void Start() override; | 38 void Start() override; |
38 void Stop() override; | 39 void Stop() override; |
39 void Pause() override; | 40 void Pause() override; |
40 void Play() override; | 41 void Play() override; |
41 bool SetVolume(double volume) override; | 42 bool SetVolume(double volume) override; |
42 OutputDeviceInfo GetOutputDeviceInfo() override; | 43 OutputDeviceInfo GetOutputDeviceInfo() override; |
43 bool CurrentThreadIsRenderingThread() override; | 44 bool CurrentThreadIsRenderingThread() override; |
44 | 45 |
45 // AudioSourceCallback implementation. | 46 // AudioSourceCallback implementation. |
46 int OnMoreData(AudioBus* dest, | 47 int OnMoreData(base::TimeTicks target_playout_time, |
47 uint32_t total_bytes_delay, | 48 int prior_frames_skipped, |
48 uint32_t frames_skipped) override; | 49 AudioBus* dest) override; |
49 void OnError(AudioOutputStream* stream) override; | 50 void OnError(AudioOutputStream* stream) override; |
50 | 51 |
51 private: | 52 private: |
52 ~AudioOutputStreamSink() override; | 53 ~AudioOutputStreamSink() override; |
53 void ClearCallback(); | 54 void ClearCallback(); |
54 | 55 |
55 // Helper methods for running AudioManager methods on the audio thread. | 56 // Helper methods for running AudioManager methods on the audio thread. |
56 void DoStart(const AudioParameters& params); | 57 void DoStart(const AudioParameters& params); |
57 void DoStop(); | 58 void DoStop(); |
58 void DoPause(); | 59 void DoPause(); |
(...skipping 20 matching lines...) Expand all Loading... |
79 | 80 |
80 // The task runner for the audio thread. | 81 // The task runner for the audio thread. |
81 const scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; | 82 const scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; |
82 | 83 |
83 // The actual AudioOutputStream, must only be accessed on the audio thread. | 84 // The actual AudioOutputStream, must only be accessed on the audio thread. |
84 AudioOutputStream* stream_; | 85 AudioOutputStream* stream_; |
85 | 86 |
86 DISALLOW_COPY_AND_ASSIGN(AudioOutputStreamSink); | 87 DISALLOW_COPY_AND_ASSIGN(AudioOutputStreamSink); |
87 }; | 88 }; |
88 | 89 |
89 } // namepace media | 90 } // namespace media |
90 | 91 |
91 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_SINK_H_ | 92 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_SINK_H_ |
OLD | NEW |