This CL is to support certain audio devices which don't offer volume control. Try to be more compatible to those rare cases.
Review URL: http://webrtc-codereview.appspot.com/276011 git-svn-id: http://webrtc.googlecode.com/svn/trunk@997 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
2b838b4121
commit
7d3e9498bc
@ -113,7 +113,7 @@ AudioDeviceWindowsWave::AudioDeviceWindowsWave(const WebRtc_Word32 id) :
|
||||
_recError(0),
|
||||
_newMicLevel(0),
|
||||
_minMicVolume(0),
|
||||
_maxMicVolume(1)
|
||||
_maxMicVolume(0)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceMemory, kTraceAudioDevice, id, "%s created", __FUNCTION__);
|
||||
|
||||
@ -628,18 +628,16 @@ WebRtc_Word32 AudioDeviceWindowsWave::InitMicrophone()
|
||||
WebRtc_UWord32 maxVol = 0;
|
||||
if (_mixerManager.MaxMicrophoneVolume(maxVol) == -1)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id,
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
|
||||
" unable to retrieve max microphone volume");
|
||||
return -1;
|
||||
}
|
||||
_maxMicVolume = maxVol;
|
||||
|
||||
WebRtc_UWord32 minVol = 0;
|
||||
if (_mixerManager.MinMicrophoneVolume(minVol) == -1)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceError, kTraceAudioDevice, _id,
|
||||
WEBRTC_TRACE(kTraceWarning, kTraceAudioDevice, _id,
|
||||
" unable to retrieve min microphone volume");
|
||||
return -1;
|
||||
}
|
||||
_minMicVolume = minVol;
|
||||
|
||||
@ -1304,6 +1302,16 @@ WebRtc_Word32 AudioDeviceWindowsWave::MicrophoneVolume(WebRtc_UWord32& volume) c
|
||||
|
||||
WebRtc_Word32 AudioDeviceWindowsWave::MaxMicrophoneVolume(WebRtc_UWord32& maxVolume) const
|
||||
{
|
||||
// _maxMicVolume can be zero in AudioMixerManager::MaxMicrophoneVolume():
|
||||
// (1) API GetLineControl() returns failure at querying the max Mic level.
|
||||
// (2) API GetLineControl() returns maxVolume as zero in rare cases.
|
||||
// Both cases show we don't have access to the mixer controls.
|
||||
// We return -1 here to indicate that.
|
||||
if (_maxMicVolume == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
maxVolume = _maxMicVolume;;
|
||||
return 0;
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user