diff options
author | Benny Prijono <bennylp@teluu.com> | 2007-12-27 07:18:35 +0000 |
---|---|---|
committer | Benny Prijono <bennylp@teluu.com> | 2007-12-27 07:18:35 +0000 |
commit | d70f06c72122824cbabba385d16670a763eeb277 (patch) | |
tree | 010b138b195128ada98a6371c31b9973d13e6c99 | |
parent | d8efa2902b83540504be0eb78ed5a74c8b28ad55 (diff) |
Handle the case when PortAudio returns negative sound device count in pasound.c
git-svn-id: http://svn.pjsip.org/repos/pjproject/trunk@1638 74dad513-b988-da41-8d7b-12977e46ad98
-rw-r--r-- | pjmedia/src/pjmedia/pasound.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/pjmedia/src/pjmedia/pasound.c b/pjmedia/src/pjmedia/pasound.c index 5472d9ae..9e0b39d1 100644 --- a/pjmedia/src/pjmedia/pasound.c +++ b/pjmedia/src/pjmedia/pasound.c @@ -235,7 +235,8 @@ PJ_DEF(pj_status_t) pjmedia_snd_init(pj_pool_factory *factory) */ PJ_DEF(int) pjmedia_snd_get_dev_count(void) { - return Pa_GetDeviceCount(); + int count = Pa_GetDeviceCount(); + return count < 0 ? 0 : count; } @@ -306,7 +307,7 @@ static int pa_get_default_input_dev(int channel_count) } /* If still no device is found, enumerate all devices */ - count = Pa_GetDeviceCount(); + count = pjmedia_snd_get_dev_count(); for (i=0; i<count; ++i) { const PaDeviceInfo *paDevInfo; @@ -362,7 +363,7 @@ static int pa_get_default_output_dev(int channel_count) } /* If still no device is found, enumerate all devices */ - count = Pa_GetDeviceCount(); + count = pjmedia_snd_get_dev_count(); for (i=0; i<count; ++i) { const PaDeviceInfo *paDevInfo; @@ -525,7 +526,7 @@ PJ_DEF(pj_status_t) pjmedia_snd_open_player( int index, stream = PJ_POOL_ZALLOC_T(pool, pjmedia_snd_stream); stream->pool = pool; pj_strdup2_with_null(pool, &stream->name, paDevInfo->name); - stream->dir = stream->dir = PJMEDIA_DIR_PLAYBACK; + stream->dir = PJMEDIA_DIR_PLAYBACK; stream->play_id = index; stream->rec_id = -1; stream->user_data = user_data; |