bug 821299 - Make ALSA WebRTC backend expose proper IDs using device names. r=jesup

--HG--
extra : rebase_source : 9ab962a7de537d55140a566bff1df2b0794d63fa
This commit is contained in:
Ted Mielczarek 2012-12-17 08:28:24 -05:00
Родитель 11d95aa6fc
Коммит 9443517959
2 изменённых файлов: 20 добавлений и 3 удалений

Просмотреть файл

@ -972,7 +972,8 @@ WebRtc_Word32 AudioDeviceLinuxALSA::RecordingDeviceName(
memset(guid, 0, kAdmMaxGuidSize);
}
return GetDevicesInfo(1, false, index, name, kAdmMaxDeviceNameSize);
return GetDevicesInfo(1, false, index, name, kAdmMaxDeviceNameSize,
guid, kAdmMaxGuidSize);
}
WebRtc_Word16 AudioDeviceLinuxALSA::RecordingDevices()
@ -1816,7 +1817,9 @@ WebRtc_Word32 AudioDeviceLinuxALSA::GetDevicesInfo(
const bool playback,
const WebRtc_Word32 enumDeviceNo,
char* enumDeviceName,
const WebRtc_Word32 ednLen) const
const WebRtc_Word32 ednLen,
char* enumDeviceId,
const WebRtc_Word32 ediLen) const
{
// Device enumeration based on libjingle implementation
@ -1855,6 +1858,8 @@ WebRtc_Word32 AudioDeviceLinuxALSA::GetDevicesInfo(
function == FUNC_GET_DEVICE_NAME_FOR_AN_ENUM) && enumDeviceNo == 0)
{
strcpy(enumDeviceName, "default");
if (enumDeviceId)
memset(enumDeviceId, 0, ediLen);
err = LATE(snd_device_name_free_hint)(hints);
if (err != 0)
@ -1917,6 +1922,11 @@ WebRtc_Word32 AudioDeviceLinuxALSA::GetDevicesInfo(
// We have found the enum device, copy the name to buffer.
strncpy(enumDeviceName, desc, ednLen);
enumDeviceName[ednLen-1] = '\0';
if (enumDeviceId)
{
strncpy(enumDeviceId, name, ediLen);
enumDeviceId[ediLen-1] = '\0';
}
keepSearching = false;
// Replace '\n' with '-'.
char * pret = strchr(enumDeviceName, '\n'/*0xa*/); //LF
@ -1929,6 +1939,11 @@ WebRtc_Word32 AudioDeviceLinuxALSA::GetDevicesInfo(
// We have found the enum device, copy the name to buffer.
strncpy(enumDeviceName, name, ednLen);
enumDeviceName[ednLen-1] = '\0';
if (enumDeviceId)
{
strncpy(enumDeviceId, name, ediLen);
enumDeviceId[ediLen-1] = '\0';
}
keepSearching = false;
}

Просмотреть файл

@ -165,7 +165,9 @@ private:
const bool playback,
const WebRtc_Word32 enumDeviceNo = 0,
char* enumDeviceName = NULL,
const WebRtc_Word32 ednLen = 0) const;
const WebRtc_Word32 ednLen = 0,
char* enumDeviceID = NULL,
const WebRtc_Word32 ediLen = 0) const;
WebRtc_Word32 ErrorRecovery(WebRtc_Word32 error, snd_pcm_t* deviceHandle);
private: