From b0d380ba06d7e7a36097d380c94a33358b68caab Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 3 May 2009 14:45:53 +0200 Subject: cFrameDetector::Analyze() now syncs on the TS packet sync bytes --- CONTRIBUTORS | 1 + HISTORY | 2 ++ remux.c | 9 ++++++++- 3 files changed, 11 insertions(+), 1 deletion(-) diff --git a/CONTRIBUTORS b/CONTRIBUTORS index 18c326c5..7bdc251b 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -671,6 +671,7 @@ Oliver Endriss for reporting that the video type is unnecessarily written into channels.conf if VPID is 0 for reporting chirping sound disturbences at editing points in TS recordings + for reporting broken index generation in TS recordings after a buffer overflow Reinhard Walter Buchner for adding some satellites to 'sources.conf' diff --git a/HISTORY b/HISTORY index ffafea42..d94e1612 100644 --- a/HISTORY +++ b/HISTORY @@ -6072,3 +6072,5 @@ Video Disk Recorder Revision History screen OSD on HD systems. - The OSD size is now automatically adjusted to the actual video display (provided the output device implements the GetVideoSize() function). +- cFrameDetector::Analyze() now syncs on the TS packet sync bytes (thanks to + Oliver Endriss for reporting broken index generation after a buffer overflow). diff --git a/remux.c b/remux.c index 10e5145c..58c05311 100644 --- a/remux.c +++ b/remux.c @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: remux.c 2.19 2009/04/19 10:59:56 kls Exp $ + * $Id: remux.c 2.20 2009/05/03 14:43:25 kls Exp $ */ #include "remux.h" @@ -722,6 +722,13 @@ int cFrameDetector::Analyze(const uchar *Data, int Length) int Processed = 0; newFrame = independentFrame = false; while (Length >= TS_SIZE) { + if (Data[0] != TS_SYNC_BYTE) { + int Skipped = 1; + while (Skipped < Length && (Data[Skipped] != TS_SYNC_BYTE || Length - Skipped > TS_SIZE && Data[Skipped + TS_SIZE] != TS_SYNC_BYTE)) + Skipped++; + esyslog("ERROR: skipped %d bytes to sync on start of TS packet", Skipped); + return Processed + Skipped; + } if (TsHasPayload(Data) && !TsIsScrambled(Data) && TsPid(Data) == pid) { if (TsPayloadStart(Data)) { if (!frameDuration) { -- cgit v1.2.3