summaryrefslogtreecommitdiffstats
path: root/libao2
diff options
context:
space:
mode:
Diffstat (limited to 'libao2')
-rw-r--r--libao2/ao_jack.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/libao2/ao_jack.c b/libao2/ao_jack.c
index 09d2dae0cd..573d6dfbf7 100644
--- a/libao2/ao_jack.c
+++ b/libao2/ao_jack.c
@@ -254,11 +254,12 @@ static int init(int rate, int channels, int format, int flags) {
if (!port_name)
port_flags |= JackPortIsPhysical;
matching_ports = jack_get_ports(client, port_name, NULL, port_flags);
- for (num_ports = 0; matching_ports && matching_ports[num_ports]; num_ports++) ;
- if (!num_ports) {
+ if (!matching_ports || !matching_ports[0]) {
mp_msg(MSGT_AO, MSGL_FATAL, "[JACK] no physical ports available\n");
goto err_out;
}
+ num_ports = 1;
+ while (matching_ports[num_ports]) num_ports++;
if (channels > num_ports) channels = num_ports;
num_ports = channels;