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() for fixing a possible freeze in pause mode in case a device's PlayPesPacket()
function permanently returns 0 function permanently returns 0
for fixing a typo in detecting UTF-8 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> Richard Robson <richard_robson@beeb.net>
for reporting freezing replay if a timer starts while in Transfer Mode from the 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<68><6C>ler). - Fixed handling transparent areas in cDvbSpuBitmap (thanks to Marco Schl<68><6C>ler).
- Now also considering the "EPG linger time" when saving the EPG data to file or - Now also considering the "EPG linger time" when saving the EPG data to file or
listing it via LSTE (thanks to Roman Krenick<63>). listing it via LSTE (thanks to Roman Krenick<63>).
- 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 * See the main source file 'vdr.c' for copyright information and
* how to reach the author. * 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" #include "device.h"
@@ -34,7 +34,7 @@ public:
int ExpectedLength(void) { return PacketSize(data); } int ExpectedLength(void) { return PacketSize(data); }
static int PacketSize(const uchar *data); static int PacketSize(const uchar *data);
int Length(void) { return length; } 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 Reset(void);
void Put(uchar c); void Put(uchar c);
void Put(const uchar *Data, int Length); void Put(const uchar *Data, int Length);
@@ -76,7 +76,7 @@ bool cPesAssembler::Realloc(int Size)
void cPesAssembler::Put(uchar c) void cPesAssembler::Put(uchar c)
{ {
if (!length) { if (length < 4) {
tag = (tag << 8) | c; tag = (tag << 8) | c;
if ((tag & 0xFFFFFF00) == 0x00000100) { if ((tag & 0xFFFFFF00) == 0x00000100) {
if (Realloc(4)) { if (Realloc(4)) {
@@ -84,6 +84,8 @@ void cPesAssembler::Put(uchar c)
length = 4; length = 4;
} }
} }
else if (length < 3)
length++;
} }
else if (Realloc(length + 1)) else if (Realloc(length + 1))
data[length++] = c; data[length++] = c;
@@ -91,7 +93,7 @@ void cPesAssembler::Put(uchar c)
void cPesAssembler::Put(const uchar *Data, int Length) void cPesAssembler::Put(const uchar *Data, int Length)
{ {
while (!length && Length > 0) { while (length < 4 && Length > 0) {
Put(*Data++); Put(*Data++);
Length--; Length--;
} }