Fixed syncing the frame checker to I-frames

This commit is contained in:
Klaus Schmidinger 2024-09-20 14:21:39 +02:00
parent 292af5d4f4
commit d8ab5dc5c6

11
remux.c
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 5.11 2024/09/18 09:23:07 kls Exp $ * $Id: remux.c 5.12 2024/09/20 14:21:39 kls Exp $
*/ */
#include "remux.h" #include "remux.h"
@ -2014,7 +2014,7 @@ public:
void SetMissing(void) { missingFrames++; } void SetMissing(void) { missingFrames++; }
void SetFrameDelta(int FrameDelta) { frameDelta = FrameDelta; } void SetFrameDelta(int FrameDelta) { frameDelta = FrameDelta; }
void CheckTs(const uchar *Data, int Length); void CheckTs(const uchar *Data, int Length);
void CheckFrame(const uchar *Data, int Length); void CheckFrame(const uchar *Data, int Length, bool IndependentFrame);
int PreviousErrors(void) { return previousErrors; } int PreviousErrors(void) { return previousErrors; }
int MissingFrames(void) { return missingFrames; } int MissingFrames(void) { return missingFrames; }
}; };
@ -2042,7 +2042,7 @@ void cFrameChecker::CheckTs(const uchar *Data, int Length)
tsChecker.CheckTs(Data, Length); tsChecker.CheckTs(Data, Length);
} }
void cFrameChecker::CheckFrame(const uchar *Data, int Length) void cFrameChecker::CheckFrame(const uchar *Data, int Length, bool IndependentFrame)
{ {
previousErrors = tsChecker.Errors(); previousErrors = tsChecker.Errors();
missingFrames = errors; missingFrames = errors;
@ -2079,7 +2079,7 @@ void cFrameChecker::CheckFrame(const uchar *Data, int Length)
else else
Report("zero diff"); Report("zero diff");
} }
else else if (IndependentFrame)
lastPts = Pts; lastPts = Pts;
} }
else else
@ -2196,8 +2196,7 @@ int cFrameDetector::Analyze(const uchar *Data, int Length)
independentFrame = parser->IndependentFrame(); independentFrame = parser->IndependentFrame();
firstIframeSeen |= independentFrame; firstIframeSeen |= independentFrame;
if (synced) { if (synced) {
if (firstIframeSeen) frameChecker->CheckFrame(Data, n, independentFrame);
frameChecker->CheckFrame(Data, n);
if (framesPerPayloadUnit <= 1) if (framesPerPayloadUnit <= 1)
scanning = false; scanning = false;
} }