[PATCH] pjmedia: alsa_dev: always list all devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The ALSA wrapper of PJMedia tries to open audio devices when refreshing
audio device list, and if this fails, it won't add the desired device to
its internal device list. This is in contrary to PJMedia audiodev API
description, where it is stated to list all devices installed in system
(see pjmedia_aud_dev_refresh() for reference). It would be better to
distinguish between a pure device list and available devices. This patch
just adds all devices but sets their channel count to zero to indicate
that the given device can not be used at the moment.


---
 pjmedia/src/pjmedia-audiodev/alsa_dev.c | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/pjmedia/src/pjmedia-audiodev/alsa_dev.c
b/pjmedia/src/pjmedia-audiodev/alsa_dev.c
index 52d421fe..742c6815 100644
--- a/pjmedia/src/pjmedia-audiodev/alsa_dev.c
+++ b/pjmedia/src/pjmedia-audiodev/alsa_dev.c
@@ -305,8 +305,11 @@ static pj_status_t add_dev (struct alsa_factory
*af, const char *dev_name)
 
     /* Check if the device could be opened in playback or capture mode */
     if (pb_result<0 && ca_result<0) {
-       TRACE_((THIS_FILE, "Unable to open sound device %s", dev_name));
-       return PJMEDIA_EAUD_NODEV;
+       TRACE_((THIS_FILE, "Unable to open sound device %s, setting "
+               "in/out channel count to 0", dev_name));
+       /* Set playback/capture channel count to 0 to indicate not
available device */
+       adi->output_count = 0;
+       adi->input_count =  0;
     }
 
     /* Set device name */
-- 
2.13.7



_______________________________________________
Visit our blog: http://blog.pjsip.org

pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org




[Index of Archives]     [Asterisk Users]     [Asterisk App Development]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Security]     [Bugtraq]     [Linux]     [Linux OMAP]     [Linux MIPS]     [Linux API]
  Powered by Linux