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

Fixed broken recordings after a driver buffer overflow

This commit is contained in:
Klaus Schmidinger 2001-08-19 14:37:17 +02:00
parent e994e3a4fe
commit 73870fc907
3 changed files with 34 additions and 8 deletions

View File

@ -650,7 +650,7 @@ Video Disk Recorder Revision History
only once. only once.
- Made I/O more robust by handling EINTR (thanks to Werner Fink). - Made I/O more robust by handling EINTR (thanks to Werner Fink).
2001-08-17: Version 0.92 2001-08-18: Version 0.92
- The "channel not sync'ed" log message now also lists the card number. - The "channel not sync'ed" log message now also lists the card number.
- Now using the EIT services from 'libdtv' (thanks to Rolf Hakenes), which - Now using the EIT services from 'libdtv' (thanks to Rolf Hakenes), which
@ -660,3 +660,4 @@ Video Disk Recorder Revision History
bugs are fixed can be controlled with the EPGBugfixLevel parameter in the bugs are fixed can be controlled with the EPGBugfixLevel parameter in the
"Setup" menu (see MANUAL for details, and cEventInfo::FixEpgBugs() in eit.c "Setup" menu (see MANUAL for details, and cEventInfo::FixEpgBugs() in eit.c
for the actual implementation). for the actual implementation).
- Fixed broken recordings after a driver buffer overflow.

View File

@ -7,7 +7,7 @@
* DVD support initially written by Andreas Schultz <aschultz@warp10.net> * DVD support initially written by Andreas Schultz <aschultz@warp10.net>
* based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si> * based on dvdplayer-0.5 by Matjaz Thaler <matjaz.thaler@guest.arnes.si>
* *
* $Id: dvbapi.c 1.107 2001/08/15 09:07:19 kls Exp $ * $Id: dvbapi.c 1.108 2001/08/19 14:36:38 kls Exp $
*/ */
//#define DVDDEBUG 1 //#define DVDDEBUG 1
@ -545,9 +545,13 @@ void cRecordBuffer::Input(void)
} }
else if (r < 0) { else if (r < 0) {
if (FATALERRNO) { if (FATALERRNO) {
LOG_ERROR; if (errno == EBUFFEROVERFLOW) { // this error code is not defined in the library
if (errno != EBUFFEROVERFLOW) esyslog(LOG_ERR, "ERROR (%s,%d): DVB driver buffer overflow", __FILE__, __LINE__);
}
else {
LOG_ERROR;
break; break;
}
} }
} }
if (time(NULL) - t > MAXBROKENTIMEOUT) { if (time(NULL) - t > MAXBROKENTIMEOUT) {
@ -2075,9 +2079,13 @@ void cTransferBuffer::Input(void)
} }
else if (r < 0) { else if (r < 0) {
if (FATALERRNO) { if (FATALERRNO) {
LOG_ERROR; if (errno == EBUFFEROVERFLOW) { // this error code is not defined in the library
if (errno != EBUFFEROVERFLOW) esyslog(LOG_ERR, "ERROR (%s,%d): DVB driver buffer overflow", __FILE__, __LINE__);
}
else {
LOG_ERROR;
break; break;
}
} }
} }
} }

21
remux.c
View File

@ -8,7 +8,7 @@
* the Linux DVB driver's 'tuxplayer' example and were rewritten to suit * the Linux DVB driver's 'tuxplayer' example and were rewritten to suit
* VDR's needs. * VDR's needs.
* *
* $Id: remux.c 1.5 2001/06/24 16:37:23 kls Exp $ * $Id: remux.c 1.6 2001/08/19 11:52:05 kls Exp $
*/ */
/* The calling interface of the 'cRemux::Process()' function is defined /* The calling interface of the 'cRemux::Process()' function is defined
@ -489,6 +489,8 @@ void cRemux::SetAudioPid(int APid)
resultCount = resultDelivered = 0; resultCount = resultDelivered = 0;
} }
#define TS_SYNC_BYTE 0x47
const uchar *cRemux::Process(const uchar *Data, int &Count, int &Result, uchar *PictureType) const uchar *cRemux::Process(const uchar *Data, int &Count, int &Result, uchar *PictureType)
{ {
uchar dummyPictureType; uchar dummyPictureType;
@ -511,12 +513,27 @@ XXX*/
resultDelivered = 0; resultDelivered = 0;
} }
int used = 0;
// Make sure we are looking at a TS packet:
while (Count > TS_SIZE) {
if (Data[0] == TS_SYNC_BYTE && Data[TS_SIZE] == TS_SYNC_BYTE)
break;
Data++;
Count--;
used++;
}
if (used)
esyslog(LOG_ERR, "ERROR: skipped %d byte to sync on TS packet", used);
// Convert incoming TS data into multiplexed PES: // Convert incoming TS data into multiplexed PES:
int used = 0;
for (int i = 0; i < Count; i += TS_SIZE) { for (int i = 0; i < Count; i += TS_SIZE) {
if (Count - i < TS_SIZE) if (Count - i < TS_SIZE)
break; break;
if (Data[i] != TS_SYNC_BYTE)
break;
int pid = GetPid(Data + i + 1); int pid = GetPid(Data + i + 1);
if (Data[i + 3] & 0x10) { // got payload if (Data[i + 3] & 0x10) { // got payload
if (pid == vPid) vTS2PES->ts_to_pes(Data + i); if (pid == vPid) vTS2PES->ts_to_pes(Data + i);