summaryrefslogtreecommitdiffstats
path: root/media/audio/pulse
diff options
context:
space:
mode:
authorhenrika@chromium.org <henrika@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-28 11:51:42 +0000
committerhenrika@chromium.org <henrika@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-05-28 11:51:42 +0000
commitaffb228b3addc94ecb7a049fbd93412d7390f4b4 (patch)
treeed1468cd2525a9cfec0dd5befb8e6922bdc3b1e6 /media/audio/pulse
parenta26740dd0887ed17898c965ad42e789a9525a9df (diff)
downloadchromium_src-affb228b3addc94ecb7a049fbd93412d7390f4b4.zip
chromium_src-affb228b3addc94ecb7a049fbd93412d7390f4b4.tar.gz
chromium_src-affb228b3addc94ecb7a049fbd93412d7390f4b4.tar.bz2
Improved AGC update scheme for the audio backend in Chrome.
This CL serves two purposes: 1) Improve the existing "mic-volume-checking"-scheme by ensuring that we no longer calls native audio functions from the core capture thread. 2) Prepare for adding AGC to the live-audio backend. TBR=tommi@chromium.org BUG=none TEST=WebRTC loopback tests in Chrome where I monitor the microphone volume while speaking into the mic. Review URL: https://codereview.chromium.org/15563004 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@202538 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/audio/pulse')
-rw-r--r--media/audio/pulse/pulse_input.cc9
-rw-r--r--media/audio/pulse/pulse_input.h4
2 files changed, 8 insertions, 5 deletions
diff --git a/media/audio/pulse/pulse_input.cc b/media/audio/pulse/pulse_input.cc
index 4e48e10..c365c47 100644
--- a/media/audio/pulse/pulse_input.cc
+++ b/media/audio/pulse/pulse_input.cc
@@ -66,6 +66,8 @@ void PulseAudioInputStream::Start(AudioInputCallback* callback) {
if (stream_started_)
return;
+ StartAgc();
+
// Clean up the old buffer.
pa_stream_drop(handle_);
buffer_->Clear();
@@ -86,6 +88,8 @@ void PulseAudioInputStream::Stop() {
if (!stream_started_)
return;
+ StopAgc();
+
// Set the flag to false to stop filling new data to soundcard.
stream_started_ = false;
@@ -246,11 +250,10 @@ void PulseAudioInputStream::ReadData() {
// Update the AGC volume level once every second. Note that,
// |volume| is also updated each time SetVolume() is called
// through IPC by the render-side AGC.
- // QueryAgcVolume() will trigger a callback to asynchronously update the
- // |volume_|, we disregard the |normalized_volume| from QueryAgcVolume()
+ // We disregard the |normalized_volume| from GetAgcVolume()
// and use the value calculated by |volume_|.
double normalized_volume = 0.0;
- QueryAgcVolume(&normalized_volume);
+ GetAgcVolume(&normalized_volume);
normalized_volume = volume_ / GetMaxVolume();
do {
diff --git a/media/audio/pulse/pulse_input.h b/media/audio/pulse/pulse_input.h
index 00bc03f..7566eac 100644
--- a/media/audio/pulse/pulse_input.h
+++ b/media/audio/pulse/pulse_input.h
@@ -8,8 +8,8 @@
#include <string>
#include "base/threading/thread_checker.h"
+#include "media/audio/agc_audio_stream.h"
#include "media/audio/audio_device_name.h"
-#include "media/audio/audio_input_stream_impl.h"
#include "media/audio/audio_io.h"
#include "media/audio/audio_parameters.h"
@@ -23,7 +23,7 @@ namespace media {
class AudioManagerPulse;
class SeekableBuffer;
-class PulseAudioInputStream : public AudioInputStreamImpl {
+class PulseAudioInputStream : public AgcAudioStream<AudioInputStream> {
public:
PulseAudioInputStream(AudioManagerPulse* audio_manager,
const std::string& device_name,