summaryrefslogtreecommitdiffstats
path: root/media/audio/mac
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/mac
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/mac')
-rw-r--r--media/audio/mac/audio_low_latency_input_mac.cc10
-rw-r--r--media/audio/mac/audio_low_latency_input_mac.h4
2 files changed, 8 insertions, 6 deletions
diff --git a/media/audio/mac/audio_low_latency_input_mac.cc b/media/audio/mac/audio_low_latency_input_mac.cc
index cf9d180..ff2f83f 100644
--- a/media/audio/mac/audio_low_latency_input_mac.cc
+++ b/media/audio/mac/audio_low_latency_input_mac.cc
@@ -268,6 +268,7 @@ void AUAudioInputStream::Start(AudioInputCallback* callback) {
if (started_ || !audio_unit_)
return;
sink_ = callback;
+ StartAgc();
OSStatus result = AudioOutputUnitStart(audio_unit_);
if (result == noErr) {
started_ = true;
@@ -279,6 +280,7 @@ void AUAudioInputStream::Start(AudioInputCallback* callback) {
void AUAudioInputStream::Stop() {
if (!started_)
return;
+ StopAgc();
OSStatus result = AudioOutputUnitStop(audio_unit_);
if (result == noErr) {
started_ = false;
@@ -483,11 +485,11 @@ OSStatus AUAudioInputStream::Provide(UInt32 number_of_frames,
// Update the capture latency.
double capture_latency_frames = GetCaptureLatency(time_stamp);
- // 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.
+ // The AGC volume level is updated once every second on a separate thread.
+ // Note that, |volume| is also updated each time SetVolume() is called
+ // through IPC by the render-side AGC.
double normalized_volume = 0.0;
- QueryAgcVolume(&normalized_volume);
+ GetAgcVolume(&normalized_volume);
AudioBuffer& buffer = io_data->mBuffers[0];
uint8* audio_data = reinterpret_cast<uint8*>(buffer.mData);
diff --git a/media/audio/mac/audio_low_latency_input_mac.h b/media/audio/mac/audio_low_latency_input_mac.h
index 04a4ff8..07a727b 100644
--- a/media/audio/mac/audio_low_latency_input_mac.h
+++ b/media/audio/mac/audio_low_latency_input_mac.h
@@ -42,8 +42,8 @@
#include "base/atomicops.h"
#include "base/memory/scoped_ptr.h"
#include "base/synchronization/lock.h"
+#include "media/audio/agc_audio_stream.h"
#include "media/audio/audio_io.h"
-#include "media/audio/audio_input_stream_impl.h"
#include "media/audio/audio_parameters.h"
#include "media/base/seekable_buffer.h"
@@ -52,7 +52,7 @@ namespace media {
class AudioManagerMac;
class DataBuffer;
-class AUAudioInputStream : public AudioInputStreamImpl {
+class AUAudioInputStream : public AgcAudioStream<AudioInputStream> {
public:
// The ctor takes all the usual parameters, plus |manager| which is the
// the audio manager who is creating this object.