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 // RenderAudioSourceProvider provides a bridge between classes: | 5 // RenderAudioSourceProvider provides a bridge between classes: |
6 // WebKit::WebAudioSourceProvider <---> media::AudioRendererSink | 6 // WebKit::WebAudioSourceProvider <---> media::AudioRendererSink |
7 // | 7 // |
8 // RenderAudioSourceProvider is a "sink" of audio, and uses a default | 8 // RenderAudioSourceProvider is a "sink" of audio, and uses a default |
9 // AudioDevice if a client has not explicitly been set. | 9 // AudioDevice if a client has not explicitly been set. |
10 // | 10 // |
11 // WebKit optionally sets a client, and then periodically calls provideInput() | 11 // WebKit optionally sets a client, and then periodically calls provideInput() |
12 // to render a certain number of audio sample-frames. provideInput() | 12 // to render a certain number of audio sample-frames. provideInput() |
13 // uses the renderer to get this data, and then massages it into the form | 13 // uses the renderer to get this data, and then massages it into the form |
14 // required by provideInput(). In this case, the default AudioDevice | 14 // required by provideInput(). In this case, the default AudioDevice |
15 // is no longer used. | 15 // is no longer used. |
16 // | 16 // |
17 // THREAD SAFETY: | 17 // THREAD SAFETY: |
18 // It is assumed that the callers to setClient() and provideInput() | 18 // It is assumed that the callers to setClient() and provideInput() |
19 // implement appropriate locking for thread safety when making | 19 // implement appropriate locking for thread safety when making |
20 // these calls. This happens in WebKit. | 20 // these calls. This happens in WebKit. |
21 | 21 |
22 #ifndef CONTENT_RENDERER_MEDIA_RENDER_AUDIOSOURCEPROVIDER_H_ | 22 #ifndef CONTENT_RENDERER_MEDIA_RENDER_AUDIOSOURCEPROVIDER_H_ |
23 #define CONTENT_RENDERER_MEDIA_RENDER_AUDIOSOURCEPROVIDER_H_ | 23 #define CONTENT_RENDERER_MEDIA_RENDER_AUDIOSOURCEPROVIDER_H_ |
24 | 24 |
25 #include <vector> | 25 #include <vector> |
26 | 26 |
27 #include "content/renderer/media/audio_device.h" | 27 #include "base/synchronization/lock.h" |
28 #include "media/base/audio_renderer_sink.h" | 28 #include "media/base/audio_renderer_sink.h" |
29 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" | 29 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h" |
30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvide r.h" | 30 #include "third_party/WebKit/Source/WebKit/chromium/public/WebAudioSourceProvide r.h" |
31 | 31 |
32 class AudioDeviceFactoryInterface; | |
33 | |
32 namespace WebKit { | 34 namespace WebKit { |
33 class WebAudioSourceProviderClient; | 35 class WebAudioSourceProviderClient; |
34 } | 36 } |
35 | 37 |
36 class RenderAudioSourceProvider | 38 class RenderAudioSourceProvider |
37 : public WebKit::WebAudioSourceProvider, | 39 : public WebKit::WebAudioSourceProvider, |
38 public media::AudioRendererSink { | 40 public media::AudioRendererSink { |
39 public: | 41 public: |
40 RenderAudioSourceProvider(); | 42 explicit RenderAudioSourceProvider( |
43 AudioDeviceFactoryInterface* audio_device_factory); | |
Chris Rogers
2012/06/14 17:41:44
This seems unnecessarily complex to require a fact
| |
41 | 44 |
42 // WebKit::WebAudioSourceProvider implementation. | 45 // WebKit::WebAudioSourceProvider implementation. |
43 | 46 |
44 // WebKit calls setClient() if it desires to take control of the rendered | 47 // WebKit calls setClient() if it desires to take control of the rendered |
45 // audio stream. We call client's setFormat() when the audio stream format | 48 // audio stream. We call client's setFormat() when the audio stream format |
46 // is known. | 49 // is known. |
47 virtual void setClient(WebKit::WebAudioSourceProviderClient* client); | 50 virtual void setClient(WebKit::WebAudioSourceProviderClient* client); |
48 | 51 |
49 // If setClient() has been called, then WebKit calls provideInput() | 52 // If setClient() has been called, then WebKit calls provideInput() |
50 // periodically to get the rendered audio stream. | 53 // periodically to get the rendered audio stream. |
(...skipping 28 matching lines...) Expand all Loading... | |
79 // Protects access to sink_ | 82 // Protects access to sink_ |
80 base::Lock sink_lock_; | 83 base::Lock sink_lock_; |
81 | 84 |
82 // default_sink_ is the default sink. | 85 // default_sink_ is the default sink. |
83 scoped_refptr<media::AudioRendererSink> default_sink_; | 86 scoped_refptr<media::AudioRendererSink> default_sink_; |
84 | 87 |
85 DISALLOW_COPY_AND_ASSIGN(RenderAudioSourceProvider); | 88 DISALLOW_COPY_AND_ASSIGN(RenderAudioSourceProvider); |
86 }; | 89 }; |
87 | 90 |
88 #endif // CONTENT_RENDERER_MEDIA_RENDER_AUDIOSOURCEPROVIDER_H_ | 91 #endif // CONTENT_RENDERER_MEDIA_RENDER_AUDIOSOURCEPROVIDER_H_ |
OLD | NEW |