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_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ |
6 #define CONTENT_RENDERER_MEDIA_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ | 6 #define CONTENT_RENDERER_MEDIA_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
11 #include "content/renderer/media/audio_device.h" | 11 #include "content/renderer/media/audio_device.h" |
12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebAudioDevi
ce.h" | 12 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebAudioDevi
ce.h" |
13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 13 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
14 | 14 |
15 namespace media { | |
16 class AudioParameters; | 15 class AudioParameters; |
17 } | |
18 | 16 |
19 class RendererWebAudioDeviceImpl | 17 class RendererWebAudioDeviceImpl : public WebKit::WebAudioDevice, |
20 : public WebKit::WebAudioDevice, | 18 public AudioDevice::RenderCallback { |
21 public AudioDevice::RenderCallback { | |
22 public: | 19 public: |
23 RendererWebAudioDeviceImpl(const media::AudioParameters& params, | 20 RendererWebAudioDeviceImpl(const AudioParameters& params, |
24 WebKit::WebAudioDevice::RenderCallback* callback); | 21 WebKit::WebAudioDevice::RenderCallback* callback); |
25 virtual ~RendererWebAudioDeviceImpl(); | 22 virtual ~RendererWebAudioDeviceImpl(); |
26 | 23 |
27 // WebKit::WebAudioDevice implementation. | 24 // WebKit::WebAudioDevice implementation. |
28 virtual void start(); | 25 virtual void start(); |
29 virtual void stop(); | 26 virtual void stop(); |
30 virtual double sampleRate(); | 27 virtual double sampleRate(); |
31 | 28 |
32 // AudioDevice::RenderCallback implementation. | 29 // AudioDevice::RenderCallback implementation. |
33 virtual size_t Render(const std::vector<float*>& audio_data, | 30 virtual size_t Render(const std::vector<float*>& audio_data, |
34 size_t number_of_frames, | 31 size_t number_of_frames, |
35 size_t audio_delay_milliseconds) OVERRIDE; | 32 size_t audio_delay_milliseconds) OVERRIDE; |
36 virtual void OnRenderError() OVERRIDE; | 33 virtual void OnRenderError() OVERRIDE; |
37 | 34 |
38 private: | 35 private: |
39 scoped_refptr<AudioDevice> audio_device_; | 36 scoped_refptr<AudioDevice> audio_device_; |
40 bool is_running_; | 37 bool is_running_; |
41 | 38 |
42 // Weak reference to the callback into WebKit code. | 39 // Weak reference to the callback into WebKit code. |
43 WebKit::WebAudioDevice::RenderCallback* client_callback_; | 40 WebKit::WebAudioDevice::RenderCallback* client_callback_; |
44 | 41 |
45 DISALLOW_COPY_AND_ASSIGN(RendererWebAudioDeviceImpl); | 42 DISALLOW_COPY_AND_ASSIGN(RendererWebAudioDeviceImpl); |
46 }; | 43 }; |
47 | 44 |
48 #endif // CONTENT_RENDERER_MEDIA_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ | 45 #endif // CONTENT_RENDERER_MEDIA_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ |
OLD | NEW |