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

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

Issue 187913002: Support the Aec dump for the APM in chrome (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: only allow calling StartAecDump() on one APM. Created 6 years, 9 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
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_WEBRTC_AUDIO_CAPTURER_H_ 5 #ifndef CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_
6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ 6 #define CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_
7 7
8 #include <list> 8 #include <list>
9 #include <string> 9 #include <string>
10 10
11 #include "base/callback.h" 11 #include "base/callback.h"
12 #include "base/memory/ref_counted.h" 12 #include "base/memory/ref_counted.h"
13 #include "base/platform_file.h"
13 #include "base/synchronization/lock.h" 14 #include "base/synchronization/lock.h"
14 #include "base/threading/thread_checker.h" 15 #include "base/threading/thread_checker.h"
15 #include "base/time/time.h" 16 #include "base/time/time.h"
16 #include "content/common/media/media_stream_options.h" 17 #include "content/common/media/media_stream_options.h"
17 #include "content/renderer/media/tagged_list.h" 18 #include "content/renderer/media/tagged_list.h"
18 #include "media/audio/audio_input_device.h" 19 #include "media/audio/audio_input_device.h"
19 #include "media/base/audio_capturer_source.h" 20 #include "media/base/audio_capturer_source.h"
20 #include "third_party/WebKit/public/platform/WebMediaConstraints.h" 21 #include "third_party/WebKit/public/platform/WebMediaConstraints.h"
21 22
22 namespace media { 23 namespace media {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 // This method is exposed to the public because the media stream track can 102 // This method is exposed to the public because the media stream track can
102 // call Stop() on its source. 103 // call Stop() on its source.
103 void Stop(); 104 void Stop();
104 105
105 // Called by the WebAudioCapturerSource to get the audio processing params. 106 // Called by the WebAudioCapturerSource to get the audio processing params.
106 // This function is triggered by provideInput() on the WebAudio audio thread, 107 // This function is triggered by provideInput() on the WebAudio audio thread,
107 // TODO(xians): Remove after moving APM from WebRtc to Chrome. 108 // TODO(xians): Remove after moving APM from WebRtc to Chrome.
108 void GetAudioProcessingParams(base::TimeDelta* delay, int* volume, 109 void GetAudioProcessingParams(base::TimeDelta* delay, int* volume,
109 bool* key_pressed); 110 bool* key_pressed);
110 111
111 // Use by the unittests to inject their own source to the capturer. 112 // Used by the unittests to inject their own source to the capturer.
112 void SetCapturerSourceForTesting( 113 void SetCapturerSourceForTesting(
113 const scoped_refptr<media::AudioCapturerSource>& source, 114 const scoped_refptr<media::AudioCapturerSource>& source,
114 media::AudioParameters params); 115 media::AudioParameters params);
115 116
117 void StartAecDump(const base::PlatformFile& aec_dump_file);
118 void StopAecDump();
119
116 protected: 120 protected:
117 friend class base::RefCountedThreadSafe<WebRtcAudioCapturer>; 121 friend class base::RefCountedThreadSafe<WebRtcAudioCapturer>;
118 virtual ~WebRtcAudioCapturer(); 122 virtual ~WebRtcAudioCapturer();
119 123
120 private: 124 private:
121 class TrackOwner; 125 class TrackOwner;
122 typedef TaggedList<TrackOwner> TrackList; 126 typedef TaggedList<TrackOwner> TrackList;
123 127
124 WebRtcAudioCapturer(int render_view_id, 128 WebRtcAudioCapturer(int render_view_id,
125 const StreamDeviceInfo& device_info, 129 const StreamDeviceInfo& device_info,
(...skipping 12 matching lines...) Expand all
138 // view id and device information. Return true if success, otherwise false. 142 // view id and device information. Return true if success, otherwise false.
139 bool Initialize(); 143 bool Initialize();
140 144
141 // SetCapturerSource() is called if the client on the source side desires to 145 // SetCapturerSource() is called if the client on the source side desires to
142 // provide their own captured audio data. Client is responsible for calling 146 // provide their own captured audio data. Client is responsible for calling
143 // Start() on its own source to have the ball rolling. 147 // Start() on its own source to have the ball rolling.
144 // Called on the main render thread. 148 // Called on the main render thread.
145 void SetCapturerSource( 149 void SetCapturerSource(
146 const scoped_refptr<media::AudioCapturerSource>& source, 150 const scoped_refptr<media::AudioCapturerSource>& source,
147 media::ChannelLayout channel_layout, 151 media::ChannelLayout channel_layout,
148 float sample_rate, 152 float sample_rate);
Henrik Grunell 2014/03/06 19:55:12 What has removing those parameters to do with the
no longer working on chromium 2014/03/06 20:00:36 They are used to create the MediaStreamAudioProces
149 int effects,
150 const blink::WebMediaConstraints& constraints);
151 153
152 // Starts recording audio. 154 // Starts recording audio.
153 // Triggered by AddSink() on the main render thread or a Libjingle working 155 // Triggered by AddSink() on the main render thread or a Libjingle working
154 // thread. It should NOT be called under |lock_|. 156 // thread. It should NOT be called under |lock_|.
155 void Start(); 157 void Start();
156 158
157 // Helper function to get the buffer size based on |peer_connection_mode_| 159 // Helper function to get the buffer size based on |peer_connection_mode_|
158 // and sample rate; 160 // and sample rate;
159 int GetBufferSize(int sample_rate) const; 161 int GetBufferSize(int sample_rate) const;
160 162
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
204 // Raw pointer to the WebRtcAudioDeviceImpl, which is valid for the lifetime 206 // Raw pointer to the WebRtcAudioDeviceImpl, which is valid for the lifetime
205 // of RenderThread. 207 // of RenderThread.
206 WebRtcAudioDeviceImpl* audio_device_; 208 WebRtcAudioDeviceImpl* audio_device_;
207 209
208 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer); 210 DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer);
209 }; 211 };
210 212
211 } // namespace content 213 } // namespace content
212 214
213 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_ 215 #endif // CONTENT_RENDERER_MEDIA_WEBRTC_AUDIO_CAPTURER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698