Add a method to inform AudioProcessing that its output will be muted.

R=turaj@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/8559004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5538 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
andrew@webrtc.org 2014-02-12 22:28:31 +00:00
parent de782180b0
commit 17342e5092
4 changed files with 22 additions and 0 deletions

View File

@ -297,6 +297,14 @@ int AudioProcessingImpl::num_output_channels() const {
return num_output_channels_;
}
void AudioProcessingImpl::set_output_will_be_muted(bool muted) {
output_will_be_muted_ = muted;
}
bool AudioProcessingImpl::output_will_be_muted() const {
return output_will_be_muted_;
}
int AudioProcessingImpl::MaybeInitializeLocked(int sample_rate_hz,
int num_input_channels, int num_output_channels, int num_reverse_channels) {
if (sample_rate_hz == sample_rate_hz_ &&

View File

@ -70,6 +70,8 @@ class AudioProcessingImpl : public AudioProcessing {
virtual int num_output_channels() const OVERRIDE;
virtual int set_num_reverse_channels(int channels) OVERRIDE;
virtual int num_reverse_channels() const OVERRIDE;
virtual void set_output_will_be_muted(bool muted) OVERRIDE;
virtual bool output_will_be_muted() const OVERRIDE;
virtual int ProcessStream(AudioFrame* frame) OVERRIDE;
virtual int AnalyzeReverseStream(AudioFrame* frame) OVERRIDE;
virtual int set_stream_delay_ms(int delay) OVERRIDE;
@ -136,6 +138,7 @@ class AudioProcessingImpl : public AudioProcessing {
int num_reverse_channels_;
int num_input_channels_;
int num_output_channels_;
bool output_will_be_muted_;
bool key_pressed_;
};

View File

@ -186,6 +186,13 @@ class AudioProcessing : public Module {
virtual int set_num_reverse_channels(int channels) = 0;
virtual int num_reverse_channels() const = 0;
// Set to true when the output of AudioProcessing will be muted or in some
// other way not used. Ideally, the captured audio would still be processed,
// but some components may change behavior based on this information.
// Default false.
virtual void set_output_will_be_muted(bool muted) = 0;
virtual bool output_will_be_muted() const = 0;
// Processes a 10 ms |frame| of the primary audio stream. On the client-side,
// this is the near-end (or captured) audio.
//

View File

@ -201,6 +201,10 @@ class MockAudioProcessing : public AudioProcessing {
int(int channels));
MOCK_CONST_METHOD0(num_reverse_channels,
int());
MOCK_METHOD1(set_output_will_be_muted,
void(bool muted));
MOCK_CONST_METHOD0(output_will_be_muted,
bool());
MOCK_METHOD1(ProcessStream,
int(AudioFrame* frame));
MOCK_METHOD1(AnalyzeReverseStream,