From: Mike Brady Date: Fri, 1 Feb 2019 21:07:13 +0000 (+0000) Subject: add a volume control mutex to serialise multiple attempts to change the volume X-Git-Tag: 3.3RC0~66^2~24 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=08e84ece27b4c9f4b00af3d3b5a4cc82f4d54964;p=thirdparty%2Fshairport-sync.git add a volume control mutex to serialise multiple attempts to change the volume --- diff --git a/rtsp.c b/rtsp.c index c60f859e..67e2a88a 100644 --- a/rtsp.c +++ b/rtsp.c @@ -2164,7 +2164,10 @@ void rtsp_conversation_thread_cleanup_function(void *arg) { } // remove flow control and mutexes - int rc = pthread_cond_destroy(&conn->flowcontrol); + int rc = pthread_mutex_destroy(&conn->volume_control_mutex); + if (rc) + debug(1, "Connection %d: error %d destroying volume_control_mutex.", conn->connection_number, rc); + rc = pthread_cond_destroy(&conn->flowcontrol); if (rc) debug(1, "Connection %d: error %d destroying flow control condition variable.", conn->connection_number, rc); @@ -2227,6 +2230,9 @@ static void *rtsp_conversation_thread_func(void *pconn) { if (rc) die("Connection %d: error %d initialising flow control condition variable.", conn->connection_number, rc); + rc = pthread_mutex_init(&conn->volume_control_mutex, NULL); + if (rc) + die("Connection %d: error %d initialising volume_control_mutex.", conn->connection_number, rc); // nothing before this is cancellable pthread_cleanup_push(rtsp_conversation_thread_cleanup_function, (void *)conn);