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