Revoked "Fixed a possible deadlock in time shift mode"

This commit is contained in:
Klaus Schmidinger 2012-02-21 11:36:49 +01:00
parent 1f22931a77
commit 42d3d99ae1
2 changed files with 16 additions and 28 deletions

View File

@ -6889,7 +6889,7 @@ Video Disk Recorder Revision History
- Fixed switching into time shift mode when pausing live video (thanks to Reinhard
Nissl for helping to debug this one).
2012-02-19: Version 1.7.25
2012-02-21: Version 1.7.25
- The fps value for channels where it differs from the default is now set correctly
when pausing live video.
@ -6899,3 +6899,6 @@ Video Disk Recorder Revision History
via udev rules.
- Added several cTimer::Set...() functions (suggested by Alexander Rieger).
- Changed the return value of cTimer::SetFile() to 'void'.
- Revoked "Fixed a possible deadlock in time shift mode" because it caused trouble with
output on vdr-xine and dxr3, and also short glitches when replaying on any output
device.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: dvbplayer.c 2.24 2012/02/19 14:31:22 kls Exp $
* $Id: dvbplayer.c 2.25 2012/02/21 11:34:04 kls Exp $
*/
#include "dvbplayer.h"
@ -87,7 +87,6 @@ class cNonBlockingFileReader : public cThread {
private:
cUnbufferedFile *f;
uchar *buffer;
uchar *result;
int wanted;
int length;
cCondWait newSet;
@ -101,7 +100,7 @@ public:
void Clear(void);
void Request(cUnbufferedFile *File, int Length);
int Result(uchar **Buffer);
bool Reading(void) { return result; }
bool Reading(void) { return buffer; }
bool WaitForDataMs(int msToWait);
};
@ -110,7 +109,6 @@ cNonBlockingFileReader::cNonBlockingFileReader(void)
{
f = NULL;
buffer = NULL;
result = NULL;
wanted = length = 0;
Start();
}
@ -120,7 +118,6 @@ cNonBlockingFileReader::~cNonBlockingFileReader()
newSet.Signal();
Cancel(3);
free(buffer);
free(result);
}
void cNonBlockingFileReader::Clear(void)
@ -129,8 +126,6 @@ void cNonBlockingFileReader::Clear(void)
f = NULL;
free(buffer);
buffer = NULL;
free(result);
result = NULL;
wanted = length = 0;
Unlock();
}
@ -142,18 +137,18 @@ void cNonBlockingFileReader::Request(cUnbufferedFile *File, int Length)
wanted = Length;
buffer = MALLOC(uchar, wanted);
f = File;
newSet.Signal();
Unlock();
newSet.Signal();
}
int cNonBlockingFileReader::Result(uchar **Buffer)
{
LOCK_THREAD;
if (result && length == wanted) {
*Buffer = result;
result = NULL;
if (buffer && length == wanted) {
*Buffer = buffer;
buffer = NULL;
return wanted;
}
}
errno = EAGAIN;
return -1;
}
@ -177,8 +172,6 @@ void cNonBlockingFileReader::Action(void)
length = wanted = r; // this will forward the error status to the caller
}
if (length == wanted) {
result = buffer;
buffer = NULL;
cMutexLock NewDataLock(&newDataMutex);
newDataCond.Broadcast();
}
@ -190,9 +183,9 @@ void cNonBlockingFileReader::Action(void)
bool cNonBlockingFileReader::WaitForDataMs(int msToWait)
{
if (result && length == wanted)
return true;
cMutexLock NewDataLock(&newDataMutex);
if (buffer && length == wanted)
return true;
return newDataCond.TimedWait(newDataMutex, msToWait);
}
@ -415,13 +408,13 @@ void cDvbPlayer::Action(void)
Goto(0, true);
while (Running()) {
if (WaitingForData)
nonBlockingFileReader->WaitForDataMs(10); // this keeps the CPU load low, but reacts immediately on new data
nonBlockingFileReader->WaitForDataMs(3); // this keeps the CPU load low, but reacts immediately on new data
else if (Sleep) {
cPoller Poller;
DevicePoll(Poller, 10);
Sleep = false;
if (playMode == pmStill || playMode == pmPause)
cCondWait::SleepMs(10);
cCondWait::SleepMs(3);
}
{
LOCK_THREAD;
@ -483,15 +476,7 @@ void cDvbPlayer::Action(void)
}
if (!eof) {
uchar *b = NULL;
int Retries = 5;
int r;
while (true) {
r = nonBlockingFileReader->Result(&b);
if (r == -1 && errno == EAGAIN && --Retries)
nonBlockingFileReader->WaitForDataMs(10);
else
break;
}
int r = nonBlockingFileReader->Result(&b);
if (r > 0) {
WaitingForData = false;
uint32_t Pts = 0;