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 "media/base/audio_renderer_sink.h" | 11 #include "media/base/audio_renderer_sink.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 content { |
| 16 class RenderView; |
| 17 } |
| 18 |
15 namespace media { | 19 namespace media { |
16 class AudioRendererSink; | 20 class AudioRendererSink; |
17 } | 21 } |
18 | 22 |
19 class RendererWebAudioDeviceImpl | 23 class RendererWebAudioDeviceImpl |
20 : public WebKit::WebAudioDevice, | 24 : public WebKit::WebAudioDevice, |
21 public media::AudioRendererSink::RenderCallback { | 25 public media::AudioRendererSink::RenderCallback { |
22 public: | 26 public: |
23 RendererWebAudioDeviceImpl(const media::AudioParameters& params, | 27 RendererWebAudioDeviceImpl(content::RenderView* render_view, |
| 28 const media::AudioParameters& params, |
24 WebKit::WebAudioDevice::RenderCallback* callback); | 29 WebKit::WebAudioDevice::RenderCallback* callback); |
25 virtual ~RendererWebAudioDeviceImpl(); | 30 virtual ~RendererWebAudioDeviceImpl(); |
26 | 31 |
27 // WebKit::WebAudioDevice implementation. | 32 // WebKit::WebAudioDevice implementation. |
28 virtual void start(); | 33 virtual void start(); |
29 virtual void stop(); | 34 virtual void stop(); |
30 virtual double sampleRate(); | 35 virtual double sampleRate(); |
31 | 36 |
32 // AudioRendererSink::RenderCallback implementation. | 37 // AudioRendererSink::RenderCallback implementation. |
33 virtual int Render(const std::vector<float*>& audio_data, | 38 virtual int Render(const std::vector<float*>& audio_data, |
34 int number_of_frames, | 39 int number_of_frames, |
35 int audio_delay_milliseconds) OVERRIDE; | 40 int audio_delay_milliseconds) OVERRIDE; |
36 virtual void OnRenderError() OVERRIDE; | 41 virtual void OnRenderError() OVERRIDE; |
37 | 42 |
38 private: | 43 private: |
39 scoped_refptr<media::AudioRendererSink> audio_device_; | 44 scoped_refptr<media::AudioRendererSink> audio_device_; |
40 bool is_running_; | 45 bool is_running_; |
41 | 46 |
42 // Weak reference to the callback into WebKit code. | 47 // Weak reference to the callback into WebKit code. |
43 WebKit::WebAudioDevice::RenderCallback* client_callback_; | 48 WebKit::WebAudioDevice::RenderCallback* client_callback_; |
44 | 49 |
45 DISALLOW_COPY_AND_ASSIGN(RendererWebAudioDeviceImpl); | 50 DISALLOW_COPY_AND_ASSIGN(RendererWebAudioDeviceImpl); |
46 }; | 51 }; |
47 | 52 |
48 #endif // CONTENT_RENDERER_MEDIA_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ | 53 #endif // CONTENT_RENDERER_MEDIA_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ |
OLD | NEW |