1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Removed the "Cleared/PlayPes(NULL, 0)" handling from cTransfer::Action(); Making sure the buffer reserve in cTransfer::Action() is re-established after clearing the buffer

This commit is contained in:
Klaus Schmidinger 2005-02-12 13:52:35 +01:00
parent 25c942c0e3
commit 7e0ffb0499
3 changed files with 21 additions and 14 deletions

View File

@ -1138,6 +1138,8 @@ Marco Schl
for adding CMD_SPU_CHG_COLCON to cDvbSpuDecoder::setTime() for adding CMD_SPU_CHG_COLCON to cDvbSpuDecoder::setTime()
for suggesting to force a new resync after a call to cRemux::Clear() for suggesting to force a new resync after a call to cRemux::Clear()
for suggestions that led to the addition of the 'Id' parameter to cAudio::Play(). for suggestions that led to the addition of the 'Id' parameter to cAudio::Play().
for removing the "Cleared/PlayPes(NULL, 0)" handling from cTransfer::Action(), since
this is now done when attaching the player to the device
Jürgen Schmitz <j.schmitz@web.de> Jürgen Schmitz <j.schmitz@web.de>
for reporting a bug in displaying the current channel when switching via the SVDRP for reporting a bug in displaying the current channel when switching via the SVDRP

View File

@ -3392,3 +3392,7 @@ Video Disk Recorder Revision History
the function the substream id of the given audio packet, so that a plugin can the function the substream id of the given audio packet, so that a plugin can
take the right action for the various kinds if audio data (based on suggestions take the right action for the various kinds if audio data (based on suggestions
by Werner Fink and Macro Schlüßler). by Werner Fink and Macro Schlüßler).
- Removed the "Cleared/PlayPes(NULL, 0)" handling from cTransfer::Action(), since this
is now done when attaching the player to the device (thanks to Marco Schlüßler).
- Making sure the buffer reserve in cTransfer::Action() is re-established after
clearing the buffer.

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: transfer.c 1.25 2005/01/23 14:27:40 kls Exp $ * $Id: transfer.c 1.26 2005/02/12 13:51:21 kls Exp $
*/ */
#include "transfer.h" #include "transfer.h"
@ -61,17 +61,12 @@ void cTransfer::Action(void)
int Result = 0; int Result = 0;
#define FW_NEEDS_BUFFER_RESERVE_FOR_AC3 #define FW_NEEDS_BUFFER_RESERVE_FOR_AC3
#ifdef FW_NEEDS_BUFFER_RESERVE_FOR_AC3 #ifdef FW_NEEDS_BUFFER_RESERVE_FOR_AC3
bool Cleared = false;
bool GotBufferReserve = false; bool GotBufferReserve = false;
#endif #endif
active = true; active = true;
while (active) { while (active) {
#ifdef FW_NEEDS_BUFFER_RESERVE_FOR_AC3 #ifdef FW_NEEDS_BUFFER_RESERVE_FOR_AC3
if (needsBufferReserve) { if (needsBufferReserve && !GotBufferReserve) {
if (IsAttached() && !Cleared) {
PlayPes(NULL, 0);
Cleared = true;
}
//XXX For dolby we've to fill the buffer because the firmware does //XXX For dolby we've to fill the buffer because the firmware does
//XXX not decode dolby but use a PCM stream for transport, therefore //XXX not decode dolby but use a PCM stream for transport, therefore
//XXX the firmware has not enough buffer for noiseless skipping early //XXX the firmware has not enough buffer for noiseless skipping early
@ -79,14 +74,12 @@ void cTransfer::Action(void)
//XXX audio is mostly to early in comparison to video). //XXX audio is mostly to early in comparison to video).
//XXX To resolve this, the remuxer or PlayPes() should synchronize //XXX To resolve this, the remuxer or PlayPes() should synchronize
//XXX audio with the video frames. 2004/09/09 Werner //XXX audio with the video frames. 2004/09/09 Werner
if (!GotBufferReserve) { if (ringBuffer->Available() < 3 * KILOBYTE(192) / 2) { // used to be MAXFRAMESIZE, but the HDTV value of KILOBYTE(512) is way too much here
if (ringBuffer->Available() < 3 * KILOBYTE(192) / 2) { // used to be MAXFRAMESIZE, but the HDTV value of KILOBYTE(512) is way too much here cCondWait::SleepMs(20); // allow the buffer to collect some reserve
cCondWait::SleepMs(20); // allow the buffer to collect some reserve continue;
continue;
}
else
GotBufferReserve = true;
} }
else
GotBufferReserve = true;
} }
#endif #endif
int Count; int Count;
@ -98,10 +91,14 @@ void cTransfer::Action(void)
// So let's clear the buffer instead of suffering from permanent // So let's clear the buffer instead of suffering from permanent
// overflows. // overflows.
dsyslog("clearing transfer buffer to avoid overflows"); dsyslog("clearing transfer buffer to avoid overflows");
DeviceClear();
ringBuffer->Clear(); ringBuffer->Clear();
remux->Clear(); remux->Clear();
PlayPes(NULL, 0); PlayPes(NULL, 0);
p = NULL; p = NULL;
#ifdef FW_NEEDS_BUFFER_RESERVE_FOR_AC3
GotBufferReserve = false;
#endif
continue; continue;
} }
Count = remux->Put(b, Count); Count = remux->Put(b, Count);
@ -132,7 +129,11 @@ void cTransfer::Action(void)
DeviceClear(); DeviceClear();
ringBuffer->Clear(); ringBuffer->Clear();
remux->Clear(); remux->Clear();
PlayPes(NULL, 0);
p = NULL; p = NULL;
#ifdef FW_NEEDS_BUFFER_RESERVE_FOR_AC3
GotBufferReserve = false;
#endif
} }
} }
} }