]> git.vomp.tv Git - vompclient.git/commitdiff
Fix a threading deadlock causing a recording playback hang
authorChris Tallon <chris@vomp.tv>
Thu, 7 Jun 2018 12:07:28 +0000 (13:07 +0100)
committerChris Tallon <chris@vomp.tv>
Thu, 7 Jun 2018 12:07:28 +0000 (13:07 +0100)
player.cc
threadp.cc

index 491650b1349cfddf9eed0e7edfaf356319838588..f7961903f0194c88d685edbf43a30f233b4d76ca 100644 (file)
--- a/player.cc
+++ b/player.cc
@@ -1182,6 +1182,7 @@ void Player::threadFeedPlay()
       {
         // demuxer is full and can't take anymore
         threadLock();
+        if (!threadActive) { threadUnlock(); threadCheckExit(); }
         threadWaitForSignal();
         threadUnlock();
       }
index a40a681a8483dd8228705793eefcf6a9813961b6..e57cfdd7e83328f7af004e74a89ebb88262d9bff 100644 (file)
@@ -45,7 +45,11 @@ int ThreadP::threadStart()
 void ThreadP::threadStop()
 {
        if (threadActive) { // we need this, on some implementations this will fail, if already stopped
-               threadActive = 0;
+
+               threadLock();
+               threadActive = 0; // New locking around this fixes a player lockup but could badly affect other things
+               threadUnlock();
+
                // Signal thread here in case it's waiting
                threadSignal();
                pthread_join(pthread, NULL);