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

Unified Diff: content/renderer/media/webrtc_audio_capturer.h

Issue 37793005: move the APM to chrome. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 2 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 side-by-side diff with in-line comments
Download patch
Index: content/renderer/media/webrtc_audio_capturer.h
diff --git a/content/renderer/media/webrtc_audio_capturer.h b/content/renderer/media/webrtc_audio_capturer.h
index eb1988d0028ae92ef6896c2974067e847ca24125..a7680d5e556a380c237a998d80d4ec1cd82de919 100644
--- a/content/renderer/media/webrtc_audio_capturer.h
+++ b/content/renderer/media/webrtc_audio_capturer.h
@@ -16,6 +16,7 @@
#include "content/renderer/media/webrtc_local_audio_source_provider.h"
#include "media/audio/audio_input_device.h"
#include "media/base/audio_capturer_source.h"
+#include "third_party/libjingle/source/talk/app/webrtc/mediaconstraintsinterface.h"
namespace media {
class AudioBus;
@@ -23,6 +24,7 @@ class AudioBus;
namespace content {
+class WebRtcAudioProcessingWrapper;
class WebRtcLocalAudioRenderer;
class WebRtcLocalAudioTrack;
@@ -55,7 +57,8 @@ class CONTENT_EXPORT WebRtcAudioCapturer
int session_id,
const std::string& device_id,
int paired_output_sample_rate,
- int paired_output_frames_per_buffer);
+ int paired_output_frames_per_buffer,
+ const webrtc::MediaConstraintsInterface* constraints);
// Add a audio track to the sinks of the capturer.
// WebRtcAudioDeviceImpl calls this method on the main render thread but
@@ -68,20 +71,27 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// Called on the main render thread or libjingle working thread.
void RemoveTrack(WebRtcLocalAudioTrack* track);
- // SetCapturerSource() is called if the client on the source side desires to
- // provide their own captured audio data. Client is responsible for calling
- // Start() on its own source to have the ball rolling.
+ // InitializeCapturerSource() is called if the client on the source side
+ // desires to provide their own captured audio data. Client is responsible
+ // for calling Start() on its own source to have the ball rolling.
// Called on the main render thread.
- void SetCapturerSource(
+ void InitializeCapturerSource(
const scoped_refptr<media::AudioCapturerSource>& source,
media::ChannelLayout channel_layout,
- float sample_rate);
+ float sample_rate,
+ const webrtc::MediaConstraintsInterface* constraints);
// Called when a stream is connecting to a peer connection. This will set
// up the native buffer size for the stream in order to optimize the
// performance for peer connection.
void EnablePeerConnectionMode();
+ void FeedRenderDataToAudioProcessing(const int16* render_audio,
+ int sample_rate,
+ int number_of_channels,
+ int number_of_frames,
+ int render_delay_ms);
+
// Volume APIs used by WebRtcAudioDeviceImpl.
// Called on the AudioInputDevice audio thread.
void SetVolume(int volume);
@@ -133,7 +143,8 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// Reconfigures the capturer with a new capture parameters.
// Must be called without holding the lock.
- void Reconfigure(int sample_rate, media::ChannelLayout channel_layout);
+ void Reconfigure(int sample_rate, media::ChannelLayout channel_layout,
+ const webrtc::MediaConstraintsInterface* constraints);
// Starts recording audio.
// Triggered by AddSink() on the main render thread or a Libjingle working
@@ -153,7 +164,7 @@ class CONTENT_EXPORT WebRtcAudioCapturer
base::ThreadChecker thread_checker_;
// Protects |source_|, |audio_tracks_|, |running_|, |loopback_fifo_|,
- // |params_|, |buffering_| and |agc_is_enabled_|.
+ // |source_params_|, |buffering_| and |agc_is_enabled_|.
mutable base::Lock lock_;
// A list of audio tracks that the audio data is fed to.
@@ -162,8 +173,11 @@ class CONTENT_EXPORT WebRtcAudioCapturer
// The audio data source from the browser process.
scoped_refptr<media::AudioCapturerSource> source_;
- // Cached audio parameters for output.
- media::AudioParameters params_;
+ // Cached audio parameters for the source.
+ media::AudioParameters source_params_;
+
+ // Cached audio parameters for the sinks.
+ media::AudioParameters sink_params_;
bool running_;
@@ -199,6 +213,8 @@ class CONTENT_EXPORT WebRtcAudioCapturer
int output_sample_rate_;
int output_frames_per_buffer_;
+ scoped_ptr<WebRtcAudioProcessingWrapper> audio_processing_;
+
DISALLOW_COPY_AND_ASSIGN(WebRtcAudioCapturer);
};

Powered by Google App Engine
This is Rietveld 408576698