cFrameDetector::Analyze() now syncs on the TS packet sync bytes

This commit is contained in:
Klaus Schmidinger 2009-05-03 14:45:53 +02:00
parent f161d1b2fe
commit b0d380ba06
3 changed files with 11 additions and 1 deletions

View File

@ -671,6 +671,7 @@ Oliver Endriss <o.endriss@gmx.de>
for reporting that the video type is unnecessarily written into channels.conf if for reporting that the video type is unnecessarily written into channels.conf if
VPID is 0 VPID is 0
for reporting chirping sound disturbences at editing points in TS recordings 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 <rw.buchner@freenet.de> Reinhard Walter Buchner <rw.buchner@freenet.de>
for adding some satellites to 'sources.conf' for adding some satellites to 'sources.conf'

View File

@ -6072,3 +6072,5 @@ Video Disk Recorder Revision History
screen OSD on HD systems. screen OSD on HD systems.
- The OSD size is now automatically adjusted to the actual video display - The OSD size is now automatically adjusted to the actual video display
(provided the output device implements the GetVideoSize() function). (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).

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: 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" #include "remux.h"
@ -722,6 +722,13 @@ int cFrameDetector::Analyze(const uchar *Data, int Length)
int Processed = 0; int Processed = 0;
newFrame = independentFrame = false; newFrame = independentFrame = false;
while (Length >= TS_SIZE) { 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 (TsHasPayload(Data) && !TsIsScrambled(Data) && TsPid(Data) == pid) {
if (TsPayloadStart(Data)) { if (TsPayloadStart(Data)) {
if (!frameDuration) { if (!frameDuration) {