summaryrefslogtreecommitdiff
path: root/pjmedia/src
diff options
context:
space:
mode:
authorBenny Prijono <bennylp@teluu.com>2007-08-22 12:34:48 +0000
committerBenny Prijono <bennylp@teluu.com>2007-08-22 12:34:48 +0000
commitede2a3f17e33709f625222b041bfe30585d5c244 (patch)
tree89263f5f57439b036f57566f9b2d5266558d1f9e /pjmedia/src
parent536bcf4b3dde60c5c9c658f18fb3804c0d824073 (diff)
Fixed bug in dsound.c: handled case when lpGUID is NULL (common for primary devices). Thanks Yejun Yang
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1422 74dad513-b988-da41-8d7b-12977e46ad98
Diffstat (limited to 'pjmedia/src')
-rw-r--r--pjmedia/src/pjmedia/dsound.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/pjmedia/src/pjmedia/dsound.c b/pjmedia/src/pjmedia/dsound.c
index 3f71edc7..dc51d975 100644
--- a/pjmedia/src/pjmedia/dsound.c
+++ b/pjmedia/src/pjmedia/dsound.c
@@ -51,6 +51,7 @@
struct dsound_dev_info
{
pjmedia_snd_dev_info info;
+ LPGUID lpGuid;
GUID guid;
};
@@ -158,7 +159,7 @@ static pj_status_t init_player_stream( struct dsound_stream *ds_strm,
/*
* Create DirectSound device.
*/
- hr = DirectSoundCreate(&dev_info[dev_id].guid, &ds_strm->ds.play.lpDs,
+ hr = DirectSoundCreate(dev_info[dev_id].lpGuid, &ds_strm->ds.play.lpDs,
NULL);
if (FAILED(hr))
return PJ_RETURN_OS_ERROR(hr);
@@ -277,7 +278,7 @@ static pj_status_t init_capture_stream( struct dsound_stream *ds_strm,
/*
* Creating recorder device.
*/
- hr = DirectSoundCaptureCreate(&dev_info[dev_id].guid,
+ hr = DirectSoundCaptureCreate(dev_info[dev_id].lpGuid,
&ds_strm->ds.capture.lpDs, NULL);
if (FAILED(hr))
return PJ_RETURN_OS_ERROR(hr);
@@ -601,8 +602,11 @@ static BOOL CALLBACK DSEnumCallback( LPGUID lpGuid, LPCSTR lpcstrDescription,
* dev_info item, by looking at the GUID.
*/
for (index=0; index<dev_count; ++index) {
- if (pj_memcmp(&dev_info[index].guid, lpGuid, sizeof(GUID))==0)
+ if ((dev_info[index].lpGuid==NULL && lpGuid==NULL) ||
+ pj_memcmp(&dev_info[index].guid, lpGuid, sizeof(GUID))==0)
+ {
break;
+ }
}
if (index == dev_count)
@@ -616,7 +620,12 @@ static BOOL CALLBACK DSEnumCallback( LPGUID lpGuid, LPCSTR lpcstrDescription,
strncpy(dev_info[index].info.name, lpcstrDescription, max);
dev_info[index].info.name[max-1] = '\0';
- pj_memcpy(&dev_info[index].guid, lpGuid, sizeof(GUID));
+ if (lpGuid == NULL) {
+ dev_info[index].lpGuid = NULL;
+ } else {
+ pj_memcpy(&dev_info[index].guid, lpGuid, sizeof(GUID));
+ dev_info[index].lpGuid = &dev_info[index].guid;
+ }
dev_info[index].info.default_samples_per_sec = 44100;
/* Just assumed that device supports stereo capture/playback */