summaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-api-frontend.c
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/alsa/alsa-api-frontend.c')
-rw-r--r--plugins/alsa/alsa-api-frontend.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/plugins/alsa/alsa-api-frontend.c b/plugins/alsa/alsa-api-frontend.c
index c01a88b..91ce63f 100644
--- a/plugins/alsa/alsa-api-frontend.c
+++ b/plugins/alsa/alsa-api-frontend.c
@@ -92,10 +92,23 @@ STATIC int ProcessOneLoop(CtlSourceT *source, json_object *loopJ, AlsaSndLoopT *
loopDefParams->sampleSize=0;
}
- // make sure useful information will not be removed
- loop->uid = strdup(loop->uid);
- if (loop->cardid) loop->cardid = strdup(loop->cardid);
- if (loop->devpath) loop->cardid = strdup(loop->devpath);
+ // Fake a sound card to check if loop is a valid Alsa snd driver
+ AlsaPcmInfoT sndLoop;
+ sndLoop.uid = loop->uid;
+ sndLoop.devpath = loop->devpath;
+ sndLoop.cardid = loop->cardid;
+ sndLoop.device = 0;
+ sndLoop.subdev = 0;
+ error = AlsaByPathDevid(source, &sndLoop);
+ if (error) {
+ AFB_ApiError(source->api, "ProcessOneLoop: loop=%s not found config=%s", loop->uid, json_object_get_string(loopJ));
+ goto OnErrorExit;
+ }
+ loop->uid= sndLoop.uid;
+ loop->devpath= sndLoop.devpath;
+ loop->cardid=sndLoop.cardid;
+ loop->cardidx=sndLoop.cardidx;
+
// Default devices is payback=0 capture=1
if (!devicesJ) {