OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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_RENDERER_WEBAUDIODEVICE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_RENDERER_WEBAUDIODEVICE_IMPL_H_ |
6 #define CONTENT_RENDERER_RENDERER_WEBAUDIODEVICE_IMPL_H_ | 6 #define CONTENT_RENDERER_RENDERER_WEBAUDIODEVICE_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/scoped_ptr.h" | 10 #include "base/ref_counted.h" |
11 #include "content/renderer/audio_device.h" | 11 #include "content/renderer/audio_device.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioDevice.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioDevice.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebVector.h" |
14 | 14 |
15 class RendererWebAudioDeviceImpl : public WebKit::WebAudioDevice, | 15 class RendererWebAudioDeviceImpl : public WebKit::WebAudioDevice, |
16 public AudioDevice::RenderCallback { | 16 public AudioDevice::RenderCallback { |
17 public: | 17 public: |
18 RendererWebAudioDeviceImpl(size_t buffer_size, | 18 RendererWebAudioDeviceImpl(size_t buffer_size, |
19 int channels, | 19 int channels, |
20 double sample_rate, | 20 double sample_rate, |
21 WebKit::WebAudioDevice::RenderCallback* callback); | 21 WebKit::WebAudioDevice::RenderCallback* callback); |
22 virtual ~RendererWebAudioDeviceImpl(); | 22 virtual ~RendererWebAudioDeviceImpl(); |
23 | 23 |
24 // WebKit::WebAudioDevice implementation. | 24 // WebKit::WebAudioDevice implementation. |
25 virtual void start(); | 25 virtual void start(); |
26 virtual void stop(); | 26 virtual void stop(); |
27 virtual double sampleRate(); | 27 virtual double sampleRate(); |
28 | 28 |
29 // AudioDevice::RenderCallback implementation. | 29 // AudioDevice::RenderCallback implementation. |
30 virtual void Render(const std::vector<float*>& audio_data, | 30 virtual void Render(const std::vector<float*>& audio_data, |
31 size_t number_of_frames); | 31 size_t number_of_frames, |
| 32 size_t audio_delay_milliseconds); |
32 | 33 |
33 private: | 34 private: |
34 scoped_ptr<AudioDevice> audio_device_; | 35 scoped_refptr<AudioDevice> audio_device_; |
35 | 36 |
36 // Weak reference to the callback into WebKit code. | 37 // Weak reference to the callback into WebKit code. |
37 WebKit::WebAudioDevice::RenderCallback* client_callback_; | 38 WebKit::WebAudioDevice::RenderCallback* client_callback_; |
38 | 39 |
39 DISALLOW_COPY_AND_ASSIGN(RendererWebAudioDeviceImpl); | 40 DISALLOW_COPY_AND_ASSIGN(RendererWebAudioDeviceImpl); |
40 }; | 41 }; |
41 | 42 |
42 #endif // CONTENT_RENDERER_RENDERER_WEBAUDIODEVICE_IMPL_H_ | 43 #endif // CONTENT_RENDERER_RENDERER_WEBAUDIODEVICE_IMPL_H_ |
OLD | NEW |