From bd186ee6b13b7eb7b41f8d0fe0f78abd177a12a8 Mon Sep 17 00:00:00 2001 From: Mark Farrugia Date: Fri, 9 Nov 2018 09:19:12 +1100 Subject: Only call 'configure' cb if there are streams for Audio Path We only want to call the Audio Path 'configure' callback when there is at least 1 stream mapped to that Audio Path. Change the return of snd_avirt_streams_get to return the number of mapped streams for a given Audio Path. Signed-off-by: Mark Farrugia --- core.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/core.c b/core.c index 6698a9e..a99f82a 100644 --- a/core.c +++ b/core.c @@ -271,7 +271,7 @@ static int snd_avirt_streams_get(const char *map, } } - return 0; + return stream_array->count; } /** @@ -322,8 +322,8 @@ int snd_avirt_audiopath_register(struct snd_avirt_audiopath *audiopath) // If we have already sealed the streams, configure this AP if (core.streams_sealed) { stream_array.count = 0; - snd_avirt_streams_get(audiopath->uid, &stream_array); - audiopath->configure(core.card, &stream_array); + if (snd_avirt_streams_get(audiopath->uid, &stream_array) > 0) + audiopath->configure(core.card, &stream_array); } return 0; @@ -420,8 +420,8 @@ int snd_avirt_streams_seal(void) for (i = 0; i < MAX_STREAMS; i++) stream_array.streams[i] = NULL; stream_array.count = 0; - snd_avirt_streams_get(ap_obj->path->uid, &stream_array); - ap_obj->path->configure(core.card, &stream_array); + if (snd_avirt_streams_get(ap_obj->path->uid, &stream_array) > 0) + ap_obj->path->configure(core.card, &stream_array); } err = snd_card_register(core.card); -- cgit 1.2.3-korg