Fixed distortions when switching to the next file during replay

This commit is contained in:
Klaus Schmidinger 2009-04-18 14:28:15 +02:00
parent fc54164405
commit efd7427bbe
2 changed files with 175 additions and 172 deletions

View File

@ -6045,3 +6045,4 @@ Video Disk Recorder Revision History
values larger than 2GB. values larger than 2GB.
- Added cDevice::NumProvidedSystems() to PLUGINS.html (was missing since it had - Added cDevice::NumProvidedSystems() to PLUGINS.html (was missing since it had
been implemented). been implemented).
- Fixed distortions when switching to the next file during replay.

View File

@ -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.12 2009/04/13 11:10:50 kls Exp $ * $Id: dvbplayer.c 2.13 2009/04/18 14:18:22 kls Exp $
*/ */
#include "dvbplayer.h" #include "dvbplayer.h"
@ -398,17 +398,15 @@ void cDvbPlayer::Action(void)
int LastReadIFrame = -1; int LastReadIFrame = -1;
int SwitchToPlayFrame = 0; int SwitchToPlayFrame = 0;
while (Running() && (NextFile() || readIndex >= 0 || ringBuffer->Available())) { while (Running()) {
if (Sleep) {
if (WaitingForData) if (WaitingForData)
nonBlockingFileReader->WaitForDataMs(3); // 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 else if (Sleep) {
cCondWait::SleepMs(3); // this keeps the CPU load low cPoller Poller;
DevicePoll(Poller, 10);
Sleep = false; Sleep = false;
} }
cPoller Poller; {
if (DevicePoll(Poller, 100)) {
LOCK_THREAD; LOCK_THREAD;
// Read the next frame from the file: // Read the next frame from the file:
@ -493,6 +491,8 @@ void cDvbPlayer::Action(void)
if (readFrame) { if (readFrame) {
if (ringBuffer->Put(readFrame)) if (ringBuffer->Put(readFrame))
readFrame = NULL; readFrame = NULL;
else
Sleep = true;
} }
} }
else else
@ -538,6 +538,8 @@ void cDvbPlayer::Action(void)
} }
else if (w < 0 && FATALERRNO) else if (w < 0 && FATALERRNO)
LOG_ERROR; LOG_ERROR;
else
Sleep = true;
} }
if (pc <= 0) { if (pc <= 0) {
if (!eof || (playDir != pdForward && playFrame->Index() > 0) || (playDir == pdForward && playFrame->Index() < readIndex)) if (!eof || (playDir != pdForward && playFrame->Index() > 0) || (playDir == pdForward && playFrame->Index() < readIndex))