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