X-Git-Url: https://gerrit.automotivelinux.org/gerrit/gitweb?a=blobdiff_plain;f=plugins%2Faudio%2Faudio-api.c;h=9c9da2514960cdf13ff55ef2fc5009229c6fcb02;hb=3259015486ecc8e246b1b69b36235d24e9d9c2ea;hp=4a8d0da1ff8363223050633c75189fceb3e43807;hpb=f16675ed24fd331903b8d6ef5d8ac07f6acbd6b0;p=src%2Fapp-framework-binder.git diff --git a/plugins/audio/audio-api.c b/plugins/audio/audio-api.c index 4a8d0da1..9c9da251 100644 --- a/plugins/audio/audio-api.c +++ b/plugins/audio/audio-api.c @@ -22,10 +22,18 @@ void _backend_init (const char *name, audioCtxHandleT *ctx) { + char *backend_env = getenv ("AFB_AUDIO_OUTPUT"); + unsigned char res = -1; + # ifdef HAVE_PULSE - if (_pulse_init (name, ctx) < 0) -# endif - _alsa_init (name, ctx); + if (!backend_env || (strcasecmp (backend_env, "Alsa") != 0)) + res = _pulse_init (name, ctx); + if (res < 0) +#endif + res = _alsa_init (name, ctx); + + if (res < 0 && verbose) + fprintf (stderr, "Could not initialize Audio backend\n"); } void _backend_free (audioCtxHandleT *ctx) { @@ -182,7 +190,7 @@ STATIC json_object* volume (AFB_request *request) { /* AFB_SESSION_CHECK */ volume_i = strtok (volume_i, ","); volume[0] = atoi (volume_i); - if (100 < volume[0] < 0) { + if ((100 < volume[0])||(volume[0] < 0)) { free (volume_i); request->errcode = MHD_HTTP_SERVICE_UNAVAILABLE; return (jsonNewMessage (AFB_FAIL, "Volume must be between 0 and 100"));