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
|
- Fixed switching into time shift mode when pausing live video (thanks to Reinhard
|
||||||
Nissl for helping to debug this one).
|
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
|
- The fps value for channels where it differs from the default is now set correctly
|
||||||
when pausing live video.
|
when pausing live video.
|
||||||
@ -6899,3 +6899,6 @@ Video Disk Recorder Revision History
|
|||||||
via udev rules.
|
via udev rules.
|
||||||
- Added several cTimer::Set...() functions (suggested by Alexander Rieger).
|
- Added several cTimer::Set...() functions (suggested by Alexander Rieger).
|
||||||
- Changed the return value of cTimer::SetFile() to 'void'.
|
- 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
|
* See the main source file 'vdr.c' for copyright information and
|
||||||
* how to reach the author.
|
* 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"
|
#include "dvbplayer.h"
|
||||||
@ -87,7 +87,6 @@ class cNonBlockingFileReader : public cThread {
|
|||||||
private:
|
private:
|
||||||
cUnbufferedFile *f;
|
cUnbufferedFile *f;
|
||||||
uchar *buffer;
|
uchar *buffer;
|
||||||
uchar *result;
|
|
||||||
int wanted;
|
int wanted;
|
||||||
int length;
|
int length;
|
||||||
cCondWait newSet;
|
cCondWait newSet;
|
||||||
@ -101,7 +100,7 @@ public:
|
|||||||
void Clear(void);
|
void Clear(void);
|
||||||
void Request(cUnbufferedFile *File, int Length);
|
void Request(cUnbufferedFile *File, int Length);
|
||||||
int Result(uchar **Buffer);
|
int Result(uchar **Buffer);
|
||||||
bool Reading(void) { return result; }
|
bool Reading(void) { return buffer; }
|
||||||
bool WaitForDataMs(int msToWait);
|
bool WaitForDataMs(int msToWait);
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -110,7 +109,6 @@ cNonBlockingFileReader::cNonBlockingFileReader(void)
|
|||||||
{
|
{
|
||||||
f = NULL;
|
f = NULL;
|
||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
result = NULL;
|
|
||||||
wanted = length = 0;
|
wanted = length = 0;
|
||||||
Start();
|
Start();
|
||||||
}
|
}
|
||||||
@ -120,7 +118,6 @@ cNonBlockingFileReader::~cNonBlockingFileReader()
|
|||||||
newSet.Signal();
|
newSet.Signal();
|
||||||
Cancel(3);
|
Cancel(3);
|
||||||
free(buffer);
|
free(buffer);
|
||||||
free(result);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void cNonBlockingFileReader::Clear(void)
|
void cNonBlockingFileReader::Clear(void)
|
||||||
@ -129,8 +126,6 @@ void cNonBlockingFileReader::Clear(void)
|
|||||||
f = NULL;
|
f = NULL;
|
||||||
free(buffer);
|
free(buffer);
|
||||||
buffer = NULL;
|
buffer = NULL;
|
||||||
free(result);
|
|
||||||
result = NULL;
|
|
||||||
wanted = length = 0;
|
wanted = length = 0;
|
||||||
Unlock();
|
Unlock();
|
||||||
}
|
}
|
||||||
@ -142,18 +137,18 @@ void cNonBlockingFileReader::Request(cUnbufferedFile *File, int Length)
|
|||||||
wanted = Length;
|
wanted = Length;
|
||||||
buffer = MALLOC(uchar, wanted);
|
buffer = MALLOC(uchar, wanted);
|
||||||
f = File;
|
f = File;
|
||||||
newSet.Signal();
|
|
||||||
Unlock();
|
Unlock();
|
||||||
|
newSet.Signal();
|
||||||
}
|
}
|
||||||
|
|
||||||
int cNonBlockingFileReader::Result(uchar **Buffer)
|
int cNonBlockingFileReader::Result(uchar **Buffer)
|
||||||
{
|
{
|
||||||
LOCK_THREAD;
|
LOCK_THREAD;
|
||||||
if (result && length == wanted) {
|
if (buffer && length == wanted) {
|
||||||
*Buffer = result;
|
*Buffer = buffer;
|
||||||
result = NULL;
|
buffer = NULL;
|
||||||
return wanted;
|
return wanted;
|
||||||
}
|
}
|
||||||
errno = EAGAIN;
|
errno = EAGAIN;
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -177,8 +172,6 @@ void cNonBlockingFileReader::Action(void)
|
|||||||
length = wanted = r; // this will forward the error status to the caller
|
length = wanted = r; // this will forward the error status to the caller
|
||||||
}
|
}
|
||||||
if (length == wanted) {
|
if (length == wanted) {
|
||||||
result = buffer;
|
|
||||||
buffer = NULL;
|
|
||||||
cMutexLock NewDataLock(&newDataMutex);
|
cMutexLock NewDataLock(&newDataMutex);
|
||||||
newDataCond.Broadcast();
|
newDataCond.Broadcast();
|
||||||
}
|
}
|
||||||
@ -190,9 +183,9 @@ void cNonBlockingFileReader::Action(void)
|
|||||||
|
|
||||||
bool cNonBlockingFileReader::WaitForDataMs(int msToWait)
|
bool cNonBlockingFileReader::WaitForDataMs(int msToWait)
|
||||||
{
|
{
|
||||||
if (result && length == wanted)
|
|
||||||
return true;
|
|
||||||
cMutexLock NewDataLock(&newDataMutex);
|
cMutexLock NewDataLock(&newDataMutex);
|
||||||
|
if (buffer && length == wanted)
|
||||||
|
return true;
|
||||||
return newDataCond.TimedWait(newDataMutex, msToWait);
|
return newDataCond.TimedWait(newDataMutex, msToWait);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,13 +408,13 @@ void cDvbPlayer::Action(void)
|
|||||||
Goto(0, true);
|
Goto(0, true);
|
||||||
while (Running()) {
|
while (Running()) {
|
||||||
if (WaitingForData)
|
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) {
|
else if (Sleep) {
|
||||||
cPoller Poller;
|
cPoller Poller;
|
||||||
DevicePoll(Poller, 10);
|
DevicePoll(Poller, 10);
|
||||||
Sleep = false;
|
Sleep = false;
|
||||||
if (playMode == pmStill || playMode == pmPause)
|
if (playMode == pmStill || playMode == pmPause)
|
||||||
cCondWait::SleepMs(10);
|
cCondWait::SleepMs(3);
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
LOCK_THREAD;
|
LOCK_THREAD;
|
||||||
@ -483,15 +476,7 @@ void cDvbPlayer::Action(void)
|
|||||||
}
|
}
|
||||||
if (!eof) {
|
if (!eof) {
|
||||||
uchar *b = NULL;
|
uchar *b = NULL;
|
||||||
int Retries = 5;
|
int r = nonBlockingFileReader->Result(&b);
|
||||||
int r;
|
|
||||||
while (true) {
|
|
||||||
r = nonBlockingFileReader->Result(&b);
|
|
||||||
if (r == -1 && errno == EAGAIN && --Retries)
|
|
||||||
nonBlockingFileReader->WaitForDataMs(10);
|
|
||||||
else
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (r > 0) {
|
if (r > 0) {
|
||||||
WaitingForData = false;
|
WaitingForData = false;
|
||||||
uint32_t Pts = 0;
|
uint32_t Pts = 0;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user