Fixes volume problem controls, happening with some Logitech headsets. Originally submitted as gips p4 depot CL 38122.
Review URL: http://webrtc-codereview.appspot.com/116008 git-svn-id: http://webrtc.googlecode.com/svn/trunk@418 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
9695e75fbd
commit
5895ea1573
@ -303,7 +303,73 @@ WebRtc_Word32 AudioMixerManager::EnumerateMicrophones()
|
||||
_microphoneState[mixId].microphoneIsValid = true;
|
||||
|
||||
// retrieve all controls for the identified wave-in destination
|
||||
GetAllLineControls(mixId, destLine, controlArray);
|
||||
if (!GetAllLineControls(mixId, destLine, controlArray))
|
||||
{
|
||||
// This destination has no controls. We must try to control
|
||||
// one of its sources instead.
|
||||
// This is a rare state but has been found for some
|
||||
// Logitech USB headsets.
|
||||
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id,
|
||||
"this destination has no controls => must control source");
|
||||
for (DWORD sourceId = 0; sourceId < destLine.cConnections; sourceId++)
|
||||
{
|
||||
GetSourceLineInfo(mixId, destId, sourceId, sourceLine, false);
|
||||
if (sourceLine.dwComponentType ==
|
||||
MIXERLINE_COMPONENTTYPE_SRC_MICROPHONE)
|
||||
{
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id,
|
||||
"found microphone source ( name: %s, ID: %u)",
|
||||
WideToUTF8(sourceLine.szName), sourceId);
|
||||
GetAllLineControls(mixId, sourceLine, controlArray, false);
|
||||
// scan the controls for this source and search for volume,
|
||||
// mute and on/off (<=> boost) controls
|
||||
for (UINT sc = 0; sc < sourceLine.cControls; sc++)
|
||||
{
|
||||
if (controlArray[sc].dwControlType ==
|
||||
MIXERCONTROL_CONTROLTYPE_VOLUME)
|
||||
{
|
||||
// store this volume control
|
||||
_microphoneState[mixId].dwVolumeControlID =
|
||||
controlArray[sc].dwControlID;
|
||||
_microphoneState[mixId].volumeControlIsValid = true;
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id,
|
||||
"found volume control (name: %s, ID: %u)",
|
||||
WideToUTF8(controlArray[sc].szName),
|
||||
controlArray[sc].dwControlID);
|
||||
}
|
||||
else if (controlArray[sc].dwControlType ==
|
||||
MIXERCONTROL_CONTROLTYPE_MUTE)
|
||||
{
|
||||
// store this mute control
|
||||
_microphoneState[mixId].dwMuteControlID =
|
||||
controlArray[sc].dwControlID;
|
||||
_microphoneState[mixId].muteControlIsValid = true;
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id,
|
||||
"found mute control (name: %s, ID: %u)",
|
||||
WideToUTF8(controlArray[sc].szName),
|
||||
controlArray[sc].dwControlID);
|
||||
}
|
||||
else if (controlArray[sc].dwControlType ==
|
||||
MIXERCONTROL_CONTROLTYPE_ONOFF ||
|
||||
controlArray[sc].dwControlType ==
|
||||
MIXERCONTROL_CONTROLTYPE_LOUDNESS)
|
||||
{
|
||||
// store this on/off control (most likely a Boost control)
|
||||
_microphoneState[mixId].dwOnOffControlID =
|
||||
controlArray[sc].dwControlID;
|
||||
_microphoneState[mixId].onOffControlIsValid = true;
|
||||
WEBRTC_TRACE(kTraceInfo, kTraceAudioDevice, _id,
|
||||
"found on/off control (name: %s, ID: %u)",
|
||||
WideToUTF8(controlArray[sc].szName),
|
||||
controlArray[sc].dwControlID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
}
|
||||
|
||||
// It seems like there are three different configurations we can find in this state:
|
||||
//
|
||||
|
Loading…
x
Reference in New Issue
Block a user