From 99d7fe6cf9ff07deac2924c3a24cb58279ba94e3 Mon Sep 17 00:00:00 2001 From: Klaus Schmidinger Date: Sun, 13 Apr 2014 14:00:42 +0200 Subject: [PATCH] Fixed a possible division by zero in frame rate detection --- HISTORY | 4 ++++ config.h | 6 +++--- remux.c | 9 +++++++-- 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/HISTORY b/HISTORY index fa6a3629..2a39d67b 100644 --- a/HISTORY +++ b/HISTORY @@ -7915,3 +7915,7 @@ Video Disk Recorder Revision History on a system with a large number of recordings. - The APIVERSION has been increased to 2.0.6 due to the changes to pat.h, sdt.h and the functional modification to cFont::CreateFont(). + +2014-04-13: Version 2.0.7 + +- Fixed a possible division by zero in frame rate detection. diff --git a/config.h b/config.h index b4d3756b..5edc93be 100644 --- a/config.h +++ b/config.h @@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * how to reach the author. * - * $Id: config.h 2.76.1.7 2014/03/22 11:00:00 kls Exp $ + * $Id: config.h 2.76.1.8 2014/04/13 14:00:42 kls Exp $ */ #ifndef __CONFIG_H @@ -22,8 +22,8 @@ // VDR's own version number: -#define VDRVERSION "2.0.6" -#define VDRVERSNUM 20006 // Version * 10000 + Major * 100 + Minor +#define VDRVERSION "2.0.7" +#define VDRVERSNUM 20007 // Version * 10000 + Major * 100 + Minor // The plugin API's version number: diff --git a/remux.c b/remux.c index c42bf933..5aed2673 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.75.1.5 2014/03/08 15:10:24 kls Exp $ + * $Id: remux.c 2.75.1.6 2014/04/13 13:59:21 kls Exp $ */ #include "remux.h" @@ -1511,7 +1511,12 @@ int cFrameDetector::Analyze(const uchar *Data, int Length) for (int i = 0; i < numPtsValues; i++) ptsValues[i] = ptsValues[i + 1] - ptsValues[i]; qsort(ptsValues, numPtsValues, sizeof(uint32_t), CmpUint32); - uint32_t Delta = ptsValues[0] / (framesPerPayloadUnit + parser->IFrameTemporalReferenceOffset()); + int Div = framesPerPayloadUnit; + if (framesPerPayloadUnit > 1) + Div += parser->IFrameTemporalReferenceOffset(); + if (Div <= 0) + Div = 1; + uint32_t Delta = ptsValues[0] / Div; // determine frame info: if (isVideo) { if (abs(Delta - 3600) <= 1)