Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2058)

Side by Side Diff: content/renderer/media/renderer_webaudiodevice_impl.h

Issue 15979015: Reland 15721002: Hook up the device selection to the WebAudio live audio (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fixed the comments. Created 7 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 "base/threading/thread_checker.h" 9 #include "base/threading/thread_checker.h"
10 #include "media/audio/audio_parameters.h" 10 #include "media/audio/audio_parameters.h"
11 #include "media/base/audio_renderer_sink.h" 11 #include "media/base/audio_renderer_sink.h"
12 #include "third_party/WebKit/public/platform/WebAudioDevice.h" 12 #include "third_party/WebKit/public/platform/WebAudioDevice.h"
13 #include "third_party/WebKit/public/platform/WebVector.h" 13 #include "third_party/WebKit/public/platform/WebVector.h"
14 14
15 namespace media { 15 namespace media {
16 class AudioOutputDevice; 16 class AudioOutputDevice;
17 } 17 }
18 18
19 namespace content { 19 namespace content {
20 20
21 class RendererWebAudioDeviceImpl 21 class RendererWebAudioDeviceImpl
22 : public WebKit::WebAudioDevice, 22 : public WebKit::WebAudioDevice,
23 public media::AudioRendererSink::RenderCallback { 23 public media::AudioRendererSink::RenderCallback {
24 public: 24 public:
25 RendererWebAudioDeviceImpl(const media::AudioParameters& params, 25 RendererWebAudioDeviceImpl(const media::AudioParameters& params,
26 WebKit::WebAudioDevice::RenderCallback* callback); 26 WebKit::WebAudioDevice::RenderCallback* callback,
27 int session_id);
27 virtual ~RendererWebAudioDeviceImpl(); 28 virtual ~RendererWebAudioDeviceImpl();
28 29
29 // WebKit::WebAudioDevice implementation. 30 // WebKit::WebAudioDevice implementation.
30 virtual void start(); 31 virtual void start();
31 virtual void stop(); 32 virtual void stop();
32 virtual double sampleRate(); 33 virtual double sampleRate();
33 34
34 // AudioRendererSink::RenderCallback implementation. 35 // AudioRendererSink::RenderCallback implementation.
35 virtual int Render(media::AudioBus* dest, 36 virtual int Render(media::AudioBus* dest,
36 int audio_delay_milliseconds) OVERRIDE; 37 int audio_delay_milliseconds) OVERRIDE;
(...skipping 10 matching lines...) Expand all
47 // Weak reference to the callback into WebKit code. 48 // Weak reference to the callback into WebKit code.
48 WebKit::WebAudioDevice::RenderCallback* const client_callback_; 49 WebKit::WebAudioDevice::RenderCallback* const client_callback_;
49 50
50 // To avoid the need for locking, ensure the control methods of the 51 // To avoid the need for locking, ensure the control methods of the
51 // WebKit::WebAudioDevice implementation are called on the same thread. 52 // WebKit::WebAudioDevice implementation are called on the same thread.
52 base::ThreadChecker thread_checker_; 53 base::ThreadChecker thread_checker_;
53 54
54 // When non-NULL, we are started. When NULL, we are stopped. 55 // When non-NULL, we are started. When NULL, we are stopped.
55 scoped_refptr<media::AudioOutputDevice> output_device_; 56 scoped_refptr<media::AudioOutputDevice> output_device_;
56 57
58 // ID to allow browser to select the correct input device for unified IO.
59 int session_id_;
60
57 DISALLOW_COPY_AND_ASSIGN(RendererWebAudioDeviceImpl); 61 DISALLOW_COPY_AND_ASSIGN(RendererWebAudioDeviceImpl);
58 }; 62 };
59 63
60 } // namespace content 64 } // namespace content
61 65
62 #endif // CONTENT_RENDERER_MEDIA_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_ 66 #endif // CONTENT_RENDERER_MEDIA_MEDIA_RENDERER_WEBAUDIODEVICE_IMPL_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698