From 1fd5bc3f19c534c82601b1e95fb0e8d3e3cc46a4 Mon Sep 17 00:00:00 2001 From: Yalu Zhang <yalu.zhang@iopsys.eu> Date: Wed, 28 Aug 2024 09:17:40 +0000 Subject: [PATCH] Update voice_connection_find to return the first connection on the line if connection is -1 The input parameter connection to the function voice_connection_find() could be unavailable (-1) sometimes. The first stream on the line shall be returned in this case regardless the actual connection value associated with the stream. --- libvoice/common.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/libvoice/common.c b/libvoice/common.c index d2ace08..f75cdd4 100644 --- a/libvoice/common.c +++ b/libvoice/common.c @@ -96,7 +96,8 @@ int voice_connection_find(int line, int connection) int conIdx; for(conIdx = 0; conIdx < max_num_connections; conIdx++) { - if(connections[conIdx].line == line && connections[conIdx].connection_id == connection) { + // If connection is -1, it means any connection on the line + if(connections[conIdx].line == line && (connections[conIdx].connection_id == connection || connection == -1)) { return conIdx; } } -- GitLab