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

Fixed cVideoRepacker to better handle errors in data

This commit is contained in:
Klaus Schmidinger 2005-08-21 09:00:31 +02:00
parent 6de23d7d96
commit 9dd6796702
2 changed files with 7 additions and 14 deletions

View File

@ -3709,3 +3709,4 @@ Video Disk Recorder Revision History
all CAMs initialized and ready to decrypt, so that no more "channel not all CAMs initialized and ready to decrypt, so that no more "channel not
available" happens if VDR is started with the current channel being an encrypted available" happens if VDR is started with the current channel being an encrypted
one, or a timer on such a channel hits right after starting VDR. one, or a timer on such a channel hits right after starting VDR.
- Fixed cVideoRepacker to better handle errors in data (thanks to Reinhard Nissl).

20
remux.c
View File

@ -11,7 +11,7 @@
* The cDolbyRepacker code was originally written by Reinhard Nissl <rnissl@gmx.de>, * The cDolbyRepacker code was originally written by Reinhard Nissl <rnissl@gmx.de>,
* and adapted to the VDR coding style by Klaus.Schmidinger@cadsoft.de. * and adapted to the VDR coding style by Klaus.Schmidinger@cadsoft.de.
* *
* $Id: remux.c 1.36 2005/07/30 10:23:00 kls Exp $ * $Id: remux.c 1.37 2005/08/21 08:58:58 kls Exp $
*/ */
#include "remux.h" #include "remux.h"
@ -171,11 +171,9 @@ bool cVideoRepacker::PushOutPacket(cRingBufferLinear *ResultBuffer, const uchar
int Bite = fragmentLen + (Count >= 0 ? 0 : Count); int Bite = fragmentLen + (Count >= 0 ? 0 : Count);
// put data into result buffer // put data into result buffer
int n = Put(ResultBuffer, fragmentData, Bite); int n = Put(ResultBuffer, fragmentData, Bite);
if (n != Bite) {
Reset();
return false;
}
fragmentLen = 0; fragmentLen = 0;
if (n != Bite)
return false;
} }
else if (pesHeaderLen > 0) { // ... which is contained in the PES header buffer else if (pesHeaderLen > 0) { // ... which is contained in the PES header buffer
int PacketLen = pesHeaderLen + Count - 6; int PacketLen = pesHeaderLen + Count - 6;
@ -186,11 +184,9 @@ bool cVideoRepacker::PushOutPacket(cRingBufferLinear *ResultBuffer, const uchar
int Bite = pesHeaderLen + (Count >= 0 ? 0 : Count); int Bite = pesHeaderLen + (Count >= 0 ? 0 : Count);
// put data into result buffer // put data into result buffer
int n = Put(ResultBuffer, pesHeader, Bite); int n = Put(ResultBuffer, pesHeader, Bite);
if (n != Bite) {
Reset();
return false;
}
pesHeaderLen = 0; pesHeaderLen = 0;
if (n != Bite)
return false;
} }
// append further payload // append further payload
if (Count > 0) { if (Count > 0) {
@ -198,10 +194,8 @@ bool cVideoRepacker::PushOutPacket(cRingBufferLinear *ResultBuffer, const uchar
int Bite = Count; int Bite = Count;
// put data into result buffer // put data into result buffer
int n = Put(ResultBuffer, Data, Bite); int n = Put(ResultBuffer, Data, Bite);
if (n != Bite) { if (n != Bite)
Reset();
return false; return false;
}
} }
// we did it ;-) // we did it ;-)
return true; return true;
@ -250,12 +244,10 @@ void cVideoRepacker::Repack(cRingBufferLinear *ResultBuffer, const uchar *Data,
switch (*data) { switch (*data) {
case 0xB9 ... 0xFF: // system start codes case 0xB9 ... 0xFF: // system start codes
esyslog("cVideoRepacker: found system start code: stream seems to be scrambled or not demultiplexed"); esyslog("cVideoRepacker: found system start code: stream seems to be scrambled or not demultiplexed");
Reset();
break; break;
case 0xB0 ... 0xB1: // reserved start codes case 0xB0 ... 0xB1: // reserved start codes
case 0xB6: case 0xB6:
esyslog("cVideoRepacker: found reserved start code: stream seems to be scrambled"); esyslog("cVideoRepacker: found reserved start code: stream seems to be scrambled");
Reset();
break; break;
case 0xB4: // sequence error code case 0xB4: // sequence error code
isyslog("cVideoRepacker: found sequence error code: stream seems to be damaged"); isyslog("cVideoRepacker: found sequence error code: stream seems to be damaged");