From a06afe8c2d4f4d54f9a1c8154c96ed75a1ca9c87 Mon Sep 17 00:00:00 2001 From: Chris Tallon Date: Thu, 15 Jun 2006 23:46:11 +0000 Subject: [PATCH] Fixes for deadlocks when no stream available --- player.cc | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/player.cc b/player.cc index c68eca1..13b7576 100644 --- 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 -- 2.39.5