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 CONTENT_RENDERER_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ |
7 | 7 |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include "base/cancelable_callback.h" | 10 #include "base/cancelable_callback.h" |
11 #include "base/macros.h" | 11 #include "base/macros.h" |
12 #include "base/memory/ref_counted.h" | 12 #include "base/memory/ref_counted.h" |
13 #include "base/threading/thread_checker.h" | 13 #include "base/threading/thread_checker.h" |
14 #include "media/audio/audio_parameters.h" | 14 #include "media/audio/audio_parameters.h" |
15 #include "media/base/audio_renderer_sink.h" | 15 #include "media/base/audio_renderer_sink.h" |
16 #include "third_party/WebKit/public/platform/WebAudioDevice.h" | 16 #include "third_party/WebKit/public/platform/WebAudioDevice.h" |
17 #include "third_party/WebKit/public/platform/WebVector.h" | 17 #include "third_party/WebKit/public/platform/WebVector.h" |
18 #include "url/origin.h" | 18 #include "url/origin.h" |
19 | 19 |
20 namespace base { | 20 namespace base { |
21 class SingleThreadTaskRunner; | 21 class SingleThreadTaskRunner; |
22 } | 22 } |
23 | 23 |
24 namespace media { | 24 namespace media { |
25 class AudioOutputDevice; | |
26 class NullAudioSink; | 25 class NullAudioSink; |
27 } | 26 } |
28 | 27 |
29 namespace content { | 28 namespace content { |
30 | 29 |
31 class RendererWebAudioDeviceImpl | 30 class RendererWebAudioDeviceImpl |
32 : public blink::WebAudioDevice, | 31 : public blink::WebAudioDevice, |
33 public media::AudioRendererSink::RenderCallback { | 32 public media::AudioRendererSink::RenderCallback { |
34 public: | 33 public: |
35 RendererWebAudioDeviceImpl(const media::AudioParameters& params, | 34 RendererWebAudioDeviceImpl(const media::AudioParameters& params, |
(...skipping 18 matching lines...) Expand all Loading... |
54 const media::AudioParameters params_; | 53 const media::AudioParameters params_; |
55 | 54 |
56 // Weak reference to the callback into WebKit code. | 55 // Weak reference to the callback into WebKit code. |
57 blink::WebAudioDevice::RenderCallback* const client_callback_; | 56 blink::WebAudioDevice::RenderCallback* const client_callback_; |
58 | 57 |
59 // To avoid the need for locking, ensure the control methods of the | 58 // To avoid the need for locking, ensure the control methods of the |
60 // blink::WebAudioDevice implementation are called on the same thread. | 59 // blink::WebAudioDevice implementation are called on the same thread. |
61 base::ThreadChecker thread_checker_; | 60 base::ThreadChecker thread_checker_; |
62 | 61 |
63 // When non-NULL, we are started. When NULL, we are stopped. | 62 // When non-NULL, we are started. When NULL, we are stopped. |
64 scoped_refptr<media::AudioOutputDevice> output_device_; | 63 scoped_refptr<media::AudioRendererSink> sink_; |
65 | 64 |
66 // ID to allow browser to select the correct input device for unified IO. | 65 // ID to allow browser to select the correct input device for unified IO. |
67 int session_id_; | 66 int session_id_; |
68 | 67 |
69 // Timeticks when the silence starts. | 68 // Timeticks when the silence starts. |
70 base::TimeTicks first_silence_time_ ; | 69 base::TimeTicks first_silence_time_ ; |
71 | 70 |
72 // TaskRunner to post callbacks to the render thread. | 71 // TaskRunner to post callbacks to the render thread. |
73 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; | 72 scoped_refptr<base::SingleThreadTaskRunner> task_runner_; |
74 | 73 |
(...skipping 17 matching lines...) Expand all Loading... |
92 | 91 |
93 // Security origin, used to check permissions for |output_device_|. | 92 // Security origin, used to check permissions for |output_device_|. |
94 url::Origin security_origin_; | 93 url::Origin security_origin_; |
95 | 94 |
96 DISALLOW_COPY_AND_ASSIGN(RendererWebAudioDeviceImpl); | 95 DISALLOW_COPY_AND_ASSIGN(RendererWebAudioDeviceImpl); |
97 }; | 96 }; |
98 | 97 |
99 } // namespace content | 98 } // namespace content |
100 | 99 |
101 #endif // CONTENT_RENDERER_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ | 100 #endif // CONTENT_RENDERER_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ |
OLD | NEW |