]> git.vomp.tv Git - vompclient.git/commitdiff
Fixes for deadlocks when no stream available r0-2-4
authorChris Tallon <chris@vomp.tv>
Thu, 15 Jun 2006 23:46:11 +0000 (23:46 +0000)
committerChris Tallon <chris@vomp.tv>
Thu, 15 Jun 2006 23:46:11 +0000 (23:46 +0000)
player.cc

index c68eca1a0db89b5d206b6791390675f55d96cd8e..13b75767203edb7f49b740b95bd7c977eba7c87d 100644 (file)
--- a/player.cc
+++ b/player.cc
@@ -179,6 +179,7 @@ int Player::play()
 void Player::stop()
 {
   lock();
+  logger->log("Player", Log::DEBUG, "Stop called lock");
   stopInt();
   unLock();
 }
@@ -319,7 +320,7 @@ void Player::stopInt()
 
   vfeed.stop();
   afeed.stop();
-  threadStop();
+  if (threadIsActive()) threadStop();
   video->stop();
   video->blank();
   audio->stop();
@@ -626,8 +627,8 @@ void Player::threadMethod()
 
     threadBuffer = vdr->getBlock(feedPosition, askFor, &thisRead);
 #ifdef NEW_DEMUXER
-  currentposition=feedPosition;
- #endif
+    currentposition=feedPosition;
+#endif
     if (!vdr->isConnected())
     {
       doConnectionLost();
@@ -722,6 +723,13 @@ void Player::threadMethod()
   // end of recording
   logger->log("Player", Log::DEBUG, "Recording playback ends");
 
+  if (videoStartup) // oh woe. there never was a stream, I was conned!
+  {
+    videoStartup = false;
+    unLock();
+    MILLISLEEP(500); // I think this will solve a race
+  }
+
   threadCheckExit();
 
   Message* m = new Message(); // Must be done after this thread finishes, and must break into master mutex