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