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::TimeDelta delay, |
47 uint32_t total_bytes_delay, | 48 base::TimeTicks delay_timestamp, |
48 uint32_t frames_skipped) override; | 49 int prior_frames_skipped, |
| 50 AudioBus* dest) override; |
49 void OnError(AudioOutputStream* stream) override; | 51 void OnError(AudioOutputStream* stream) override; |
50 | 52 |
51 private: | 53 private: |
52 ~AudioOutputStreamSink() override; | 54 ~AudioOutputStreamSink() override; |
53 void ClearCallback(); | 55 void ClearCallback(); |
54 | 56 |
55 // Helper methods for running AudioManager methods on the audio thread. | 57 // Helper methods for running AudioManager methods on the audio thread. |
56 void DoStart(const AudioParameters& params); | 58 void DoStart(const AudioParameters& params); |
57 void DoStop(); | 59 void DoStop(); |
58 void DoPause(); | 60 void DoPause(); |
(...skipping 20 matching lines...) Expand all Loading... |
79 | 81 |
80 // The task runner for the audio thread. | 82 // The task runner for the audio thread. |
81 const scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; | 83 const scoped_refptr<base::SingleThreadTaskRunner> audio_task_runner_; |
82 | 84 |
83 // The actual AudioOutputStream, must only be accessed on the audio thread. | 85 // The actual AudioOutputStream, must only be accessed on the audio thread. |
84 AudioOutputStream* stream_; | 86 AudioOutputStream* stream_; |
85 | 87 |
86 DISALLOW_COPY_AND_ASSIGN(AudioOutputStreamSink); | 88 DISALLOW_COPY_AND_ASSIGN(AudioOutputStreamSink); |
87 }; | 89 }; |
88 | 90 |
89 } // namepace media | 91 } // namespace media |
90 | 92 |
91 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_SINK_H_ | 93 #endif // MEDIA_AUDIO_AUDIO_OUTPUT_STREAM_SINK_H_ |
OLD | NEW |