Fixed handling fragments of less than 3 byte in cPesAssembler

This commit is contained in:
Klaus Schmidinger 2005-05-05 14:59:46 +02:00
parent cfab3380c7
commit 1c62f19c8c
3 changed files with 9 additions and 4 deletions

View File

@ -938,6 +938,7 @@ Reinhard Nissl <rnissl@gmx.de>
for fixing a possible freeze in pause mode in case a device's PlayPesPacket()
function permanently returns 0
for fixing a typo in detecting UTF-8
for fixing handling fragments of less than 3 byte in cPesAssembler
Richard Robson <richard_robson@beeb.net>
for reporting freezing replay if a timer starts while in Transfer Mode from the

View File

@ -3487,3 +3487,5 @@ Video Disk Recorder Revision History
- Fixed handling transparent areas in cDvbSpuBitmap (thanks to Marco Schlüßler).
- Now also considering the "EPG linger time" when saving the EPG data to file or
listing it via LSTE (thanks to Roman Krenický).
- Fixed handling fragments of less than 3 byte in cPesAssembler (thanks to
Reinhard Nissl).

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: device.c 1.99 2005/02/27 13:55:15 kls Exp $
* $Id: device.c 1.100 2005/05/05 14:48:01 kls Exp $
*/
#include "device.h"
@ -34,7 +34,7 @@ public:
int ExpectedLength(void) { return PacketSize(data); }
static int PacketSize(const uchar *data);
int Length(void) { return length; }
const uchar *Data(void) { return data; }
const uchar *Data(void) { return data; } // only valid if Length() >= 4
void Reset(void);
void Put(uchar c);
void Put(const uchar *Data, int Length);
@ -76,7 +76,7 @@ bool cPesAssembler::Realloc(int Size)
void cPesAssembler::Put(uchar c)
{
if (!length) {
if (length < 4) {
tag = (tag << 8) | c;
if ((tag & 0xFFFFFF00) == 0x00000100) {
if (Realloc(4)) {
@ -84,6 +84,8 @@ void cPesAssembler::Put(uchar c)
length = 4;
}
}
else if (length < 3)
length++;
}
else if (Realloc(length + 1))
data[length++] = c;
@ -91,7 +93,7 @@ void cPesAssembler::Put(uchar c)
void cPesAssembler::Put(const uchar *Data, int Length)
{
while (!length && Length > 0) {
while (length < 4 && Length > 0) {
Put(*Data++);
Length--;
}