Now distinguishing between frames with errors and completely missing frames

This commit is contained in:
Klaus Schmidinger 2024-09-17 11:30:28 +02:00
parent 6f6b05ffcb
commit 52c4816c9c
4 changed files with 21 additions and 9 deletions

View File

@ -9999,3 +9999,4 @@ Video Disk Recorder Revision History
- Updated the Italian OSD texts (thanks to Diego Pierotto).
- Moved error checking from recorder.c to remux.c.
- The number of errors in a recording now represents the number of broken frames.
- Now distinguishing between frames with errors and completely missing frames.

View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: recorder.c 5.8 2024/09/17 09:39:50 kls Exp $
* $Id: recorder.c 5.9 2024/09/17 11:30:28 kls Exp $
*/
#include "recorder.h"
@ -195,11 +195,14 @@ void cRecorder::Action(void)
if (!NextFile())
break;
int PreviousErrors = 0;
if (frameDetector->NewFrame(&PreviousErrors)) {
int MissingFrames = 0;
if (frameDetector->NewFrame(&PreviousErrors, &MissingFrames)) {
if (index)
index->Write(frameDetector->IndependentFrame(), fileName->Number(), fileSize);
if (PreviousErrors)
errors++;
if (MissingFrames)
errors++;
}
if (frameDetector->IndependentFrame()) {
recordFile->Write(patPmtGenerator.GetPat(), TS_SIZE);

12
remux.c
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remux.c 5.9 2024/09/16 19:56:37 kls Exp $
* $Id: remux.c 5.10 2024/09/17 11:30:28 kls Exp $
*/
#include "remux.h"
@ -2007,6 +2007,7 @@ private:
int lastFwdRef;
int errors;
int previousErrors;
int missingFrames;
void Report(const char *Message, int NumErrors = 1);
public:
cFrameChecker(void);
@ -2014,6 +2015,7 @@ public:
void CheckTs(const uchar *Data, int Length);
void CheckFrame(const uchar *Data, int Length);
int PreviousErrors(void) { return previousErrors; }
int MissingFrames(void) { return missingFrames; }
};
cFrameChecker::cFrameChecker(void)
@ -2024,6 +2026,7 @@ cFrameChecker::cFrameChecker(void)
lastFwdRef = 0;
errors = 0;
previousErrors = 0;
missingFrames = 0;
}
void cFrameChecker::Report(const char *Message, int NumErrors)
@ -2040,7 +2043,8 @@ void cFrameChecker::CheckTs(const uchar *Data, int Length)
void cFrameChecker::CheckFrame(const uchar *Data, int Length)
{
previousErrors = tsChecker.Errors() + errors;
previousErrors = tsChecker.Errors();
missingFrames = errors;
errors = 0;
tsChecker.Clear();
int64_t Pts = TsGetPts(Data, Length);
@ -2143,11 +2147,13 @@ void cFrameDetector::SetPid(int Pid, int Type)
esyslog("ERROR: unknown stream type %d (PID %d) in frame detector", type, pid);
}
bool cFrameDetector::NewFrame(int *PreviousErrors)
bool cFrameDetector::NewFrame(int *PreviousErrors, int * MissingFrames)
{
if (newFrame) {
if (PreviousErrors)
*PreviousErrors = frameChecker->PreviousErrors();
if (MissingFrames)
*MissingFrames = frameChecker->MissingFrames();
}
return newFrame;
}

10
remux.h
View File

@ -4,7 +4,7 @@
* See the main source file 'vdr.c' for copyright information and
* how to reach the author.
*
* $Id: remux.h 5.4 2024/09/16 19:56:37 kls Exp $
* $Id: remux.h 5.5 2024/09/17 11:30:28 kls Exp $
*/
#ifndef __REMUX_H
@ -565,11 +565,13 @@ public:
///< Analyze() needs to be called again with more actual data.
bool Synced(void) { return synced; }
///< Returns true if the frame detector has synced on the data stream.
bool NewFrame(int *PreviousErrors = NULL);
bool NewFrame(int *PreviousErrors = NULL, int * MissingFrames = NULL);
///< Returns true if the data given to the last call to Analyze() started a
///< new frame. If PreviousErrors is given, it will be set to the number of errors in
///< the previous frame.
///< The result returned in PreviousErrors is only valid if the function returns true.
///< the previous frame. If MissingFrames is given, it will be set to the number of
///< missing frames between the previous frame and this one.
///< The results returned in PreviousErrors and MissingFrames are only valid if the
///< function returns true.
bool IndependentFrame(void) { return independentFrame; }
///< Returns true if a new frame was detected and this is an independent frame
///< (i.e. one that can be displayed by itself, without using data from any