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

Unified Diff: media/audio/audio_input_controller.h

Issue 9702019: Adds Analog Gain Control (AGC) to the WebRTC client. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Improved AGC comments Created 8 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/audio_input_controller.h
diff --git a/media/audio/audio_input_controller.h b/media/audio/audio_input_controller.h
index 59f8d168a028b916297afead450da12033c3ea30..0ae70b6786680684a8bd9f7447ae1fe56765cd8a 100644
--- a/media/audio/audio_input_controller.h
+++ b/media/audio/audio_input_controller.h
@@ -55,12 +55,12 @@
// kRecording
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
// Close() ==> DoClose()
+// state_ = kClosed
// AudioInputStream::Stop()
// AudioInputStream::Close()
// SyncWriter::Close()
-// Closure::Run()
-// (closure-task) <----------------.
-// kClosed
+// Closure::Run() <--------------.
+// (closure-task)
//
// The audio thread itself is owned by the AudioManager that the
// AudioInputController holds a reference to. When performing tasks on the
@@ -97,7 +97,7 @@ class MEDIA_EXPORT AudioInputController
// Write certain amount of data from |data|. This method returns
// number of written bytes.
- virtual uint32 Write(const void* data, uint32 size) = 0;
+ virtual uint32 Write(const void* data, uint32 size, double volume) = 0;
// Close this synchronous writer.
virtual void Close() = 0;
@@ -157,10 +157,18 @@ class MEDIA_EXPORT AudioInputController
// This method trampolines to the audio thread.
virtual void Close(const base::Closure& closed_task);
+ // Sets the capture volume of the input stream. The value 0.0 corresponds
+ // to muted and 1.0 to maximum volume.
+ virtual void SetVolume(double volume);
+
+ // Sets the Automatic Gain Control (AGC) state of the input stream.
+ // Changing the AGC state is not supported while recording is active.
+ virtual void SetAutomaticGainControl(bool enabled);
+
// AudioInputCallback implementation. Threading details depends on the
// device-specific implementation.
virtual void OnData(AudioInputStream* stream, const uint8* src, uint32 size,
- uint32 hardware_delay_bytes) OVERRIDE;
+ uint32 hardware_delay_bytes, double volume) OVERRIDE;
virtual void OnClose(AudioInputStream* stream) OVERRIDE;
virtual void OnError(AudioInputStream* stream, int code) OVERRIDE;
@@ -187,6 +195,8 @@ class MEDIA_EXPORT AudioInputController
void DoRecord();
void DoClose();
void DoReportError(int code);
+ void DoSetVolume(double volume);
+ void DoSetAutomaticGainControl(bool enabled);
// Methods which ensures that OnError() is triggered when data recording
// times out. Both are called on the creating thread.
@@ -229,6 +239,8 @@ class MEDIA_EXPORT AudioInputController
static Factory* factory_;
+ double max_volume_;
+
DISALLOW_COPY_AND_ASSIGN(AudioInputController);
};

Powered by Google App Engine
This is Rietveld 408576698