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

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 volume updating on Mac 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 13815eeb2dfe959dae3d1418c050b5a804b42656..622cbb6b236297049f83a427f38dc682f06f1daf 100644
--- a/media/audio/audio_input_controller.h
+++ b/media/audio/audio_input_controller.h
@@ -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;
@@ -156,10 +156,17 @@ class MEDIA_EXPORT AudioInputController
// This method is called on 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.
+ 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;
@@ -186,6 +193,8 @@ class MEDIA_EXPORT AudioInputController
void DoRecord();
void DoClose(const base::Closure& closed_task);
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.
@@ -228,6 +237,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