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

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

Issue 11669004: Add chromium support for MediaStreamAudioDestinationNode - part II (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Nit Created 7 years, 11 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #ifndef CONTENT_RENDERER_MEDIA_WEBAUDIO_CAPTURER_SOURCE_H_
6 #define CONTENT_RENDERER_MEDIA_WEBAUDIO_CAPTURER_SOURCE_H_
7
8 #include "base/memory/ref_counted.h"
9 #include "base/synchronization/lock.h"
10 #include "media/audio/audio_parameters.h"
11 #include "media/base/audio_capturer_source.h"
12 #include "media/base/audio_fifo.h"
13 #include "third_party/WebKit/Source/Platform/chromium/public/WebAudioDestination Consumer.h"
14 #include "third_party/WebKit/Source/WebKit/chromium/public/platform/WebVector.h"
15
16 namespace content {
17
18 // WebAudioCapturerSource is the missing link between
19 // WebAudio's MediaStreamAudioDestinationNode and WebRtcAudioCapturer.
20 // HandleCapture() is called (indirectly) by WebAudio which dispatches
21 // to WebRtcAudioCapturer::Capture().
22 class WebAudioCapturerSource
23 : public media::AudioCapturerSource,
24 public WebKit::WebAudioDestinationConsumer {
25 public:
26 WebAudioCapturerSource();
27
28 // WebAudioDestinationConsumer implementation.
29 // Handles the audio stream from WebAudio's MediaStreamAudioDestinationNode.
30 virtual void consumeAudio(const WebKit::WebVector<const float*>& audio_data,
31 size_t number_of_frames) OVERRIDE;
32
33 // AudioCapturerSource implementation.
34 virtual void Initialize(
35 const media::AudioParameters& params,
36 media::AudioCapturerSource::CaptureCallback* callback,
37 media::AudioCapturerSource::CaptureEventHandler* event_handler) OVERRIDE;
38
39 virtual void Start() OVERRIDE;
40 virtual void Stop() OVERRIDE;
41 virtual void SetVolume(double volume) OVERRIDE { }
42 virtual void SetDevice(int session_id) OVERRIDE { }
43 virtual void SetAutomaticGainControl(bool enable) OVERRIDE { }
44
45 private:
46 virtual ~WebAudioCapturerSource();
47
48 media::AudioParameters params_;
49 media::AudioCapturerSource::CaptureCallback* callback_;
50
51 // Wraps data coming from HandleCapture().
52 scoped_ptr<media::AudioBus> wrapper_bus_;
53
54 // Bus for reading from FIFO and calling the CaptureCallback.
55 scoped_ptr<media::AudioBus> capture_bus_;
56
57 // Handles mismatch between WebAudio buffer size and WebRTC.
58 scoped_ptr<media::AudioFifo> fifo_;
59
60 // Synchronizes HandleCapture() with AudioCapturerSource calls.
61 base::Lock lock_;
62 bool started_;
63
64 DISALLOW_COPY_AND_ASSIGN(WebAudioCapturerSource);
65 };
66
67 } // namespace content
68
69 #endif // CONTENT_RENDERER_MEDIA_WEBAUDIO_CAPTURER_SOURCE_H_
OLDNEW
« no previous file with comments | « content/renderer/media/media_stream_impl.cc ('k') | content/renderer/media/webaudio_capturer_source.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698