summaryrefslogtreecommitdiff
path: root/dvbplayer.c
diff options
context:
space:
mode:
authorKlaus Schmidinger <vdr@tvdr.de>2012-02-21 11:36:49 +0100
committerKlaus Schmidinger <vdr@tvdr.de>2012-02-21 11:36:49 +0100
commit42d3d99ae136d808c857bb56b2f1e653e38d3048 (patch)
tree4e3f091b569f4cd818733359627dedef8edc4734 /dvbplayer.c
parent1f22931a77f97c43564f07bf34b877966bb339f4 (diff)
downloadvdr-42d3d99ae136d808c857bb56b2f1e653e38d3048.tar.gz
vdr-42d3d99ae136d808c857bb56b2f1e653e38d3048.tar.bz2
Revoked "Fixed a possible deadlock in time shift mode"
Diffstat (limited to 'dvbplayer.c')
-rw-r--r--dvbplayer.c39
1 files changed, 12 insertions, 27 deletions
diff --git a/dvbplayer.c b/dvbplayer.c
index 2abc186c..4fd0685c 100644
--- a/dvbplayer.c
+++ b/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;