mirror of
https://github.com/VDR4Arch/vdr.git
synced 2023-10-10 13:36:52 +02:00
Revoked "Fixed a possible deadlock in time shift mode"
This commit is contained in:
parent
1f22931a77
commit
42d3d99ae1
5
HISTORY
5
HISTORY
@ -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.
|
||||
|
39
dvbplayer.c
39
dvbplayer.c
@ -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;
|
||||
|
Loading…
Reference in New Issue
Block a user