From 3b871f8bb6726ce0aff6a410abc236fc2b800e00 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sat, 12 Feb 2005 15:54:06 +0100 Subject: [PATCH] Now using twice the buffer reserve in cTransfer if the primary DVB card is an unmodified version with only 2MB of SDRAM --- CONTRIBUTORS | 4 ++++ HISTORY | 4 ++++ dvbosd.c | 9 ++++++++- transfer.c | 13 ++++++++++--- 4 files changed, 26 insertions(+), 4 deletions(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index ba8931d4..a56a598b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -807,6 +807,7 @@ Christian Jacobsen for making the LIRC interface skip keys that come in too fast for reporting a problem in handling the '-E' options in version 1.3.18 for reporting a problem in case a station defines all 32 audio PIDs + for suggestions and experiments regarding the buffer reserve in cTransfer Andreas Mair for reporting a short display of the main menu if a plugin displays its own OSD and @@ -1263,3 +1264,6 @@ Rolf Groppe Wolfgang Rohdewald for pointing out that primaryDevice = NULL should be done before deleting the devices in cDevice::Shutdown() + +Chad Flynt + for suggestions and experiments regarding the buffer reserve in cTransfer diff --git a/HISTORY b/HISTORY index bab60b65..de570f8b 100644 --- a/HISTORY +++ b/HISTORY @@ -3399,3 +3399,7 @@ Video Disk Recorder Revision History - Added DeviceClrAvailableTracks() and DeviceSetCurrentAudioTrack() to cPlayer (thanks to Marco Schlüßler). - Fixed a typo in detecting UTF-8 (thanks to Reinhard Nissl). +- Now using twice the buffer reserve in cTransfer if the primary DVB card is an + unmodified version with only 2MB of SDRAM, to avoid audio stuttering when + playing Dolby Digital over the DVB card (thanks to Christian Jacobsen and Chad + Flynt for suggestions and experiments in that area). diff --git a/dvbosd.c b/dvbosd.c index fbf6f61c..360825fc 100644 --- a/dvbosd.c +++ b/dvbosd.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: dvbosd.c 1.25 2004/11/20 14:29:25 kls Exp $ + * $Id: dvbosd.c 1.26 2005/02/12 15:36:31 kls Exp $ */ #include "dvbosd.h" @@ -48,6 +48,13 @@ cDvbOsd::cDvbOsd(int Left, int Top, int OsdDev) cap.cmd = OSD_CAP_MEMSIZE; if (ioctl(osdDev, OSD_GET_CAPABILITY, &cap) == 0) osdMem = cap.val; + #define FW_NEEDS_BUFFER_RESERVE_FOR_AC3 + #ifdef FW_NEEDS_BUFFER_RESERVE_FOR_AC3 + //XXX This is a very ugly hack to allow cDvbOsd to reduce the buffer + //XXX requirements in cTransfer if it detects a 4MB full featured DVB card. + extern bool DvbCardWith4MBofSDRAM; + DvbCardWith4MBofSDRAM = osdMem >= 1000000; + #endif #endif // must clear all windows here to avoid flashing effects - doesn't work if done // in Flush() only for the windows that are actually used... diff --git a/transfer.c b/transfer.c index 9dd91497..331ac62b 100644 --- a/transfer.c +++ b/transfer.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: transfer.c 1.26 2005/02/12 13:51:21 kls Exp $ + * $Id: transfer.c 1.27 2005/02/12 15:54:06 kls Exp $ */ #include "transfer.h" @@ -54,14 +54,21 @@ void cTransfer::Receive(uchar *Data, int Length) } } +#define FW_NEEDS_BUFFER_RESERVE_FOR_AC3 +#ifdef FW_NEEDS_BUFFER_RESERVE_FOR_AC3 +//XXX This is a very ugly hack to allow cDvbOsd to reduce the buffer +//XXX requirements in cTransfer if it detects a 4MB full featured DVB card. +bool DvbCardWith4MBofSDRAM = false; +#endif + void cTransfer::Action(void) { int PollTimeouts = 0; uchar *p = NULL; int Result = 0; -#define FW_NEEDS_BUFFER_RESERVE_FOR_AC3 #ifdef FW_NEEDS_BUFFER_RESERVE_FOR_AC3 bool GotBufferReserve = false; + int RequiredBufferReserve = KILOBYTE(DvbCardWith4MBofSDRAM ? 288 : 576); #endif active = true; while (active) { @@ -74,7 +81,7 @@ void cTransfer::Action(void) //XXX audio is mostly to early in comparison to video). //XXX To resolve this, the remuxer or PlayPes() should synchronize //XXX audio with the video frames. 2004/09/09 Werner - 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() < RequiredBufferReserve) { // 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 continue; }