1
0
mirror of https://github.com/VDR4Arch/vdr.git synced 2023-10-10 13:36:52 +02:00

Fixed a possible division by zero in frame rate detection

This commit is contained in:
Klaus Schmidinger 2014-04-13 13:50:04 +02:00
parent 4fc8101910
commit 57222002b2
2 changed files with 9 additions and 3 deletions

View File

@ -8261,7 +8261,7 @@ Video Disk Recorder Revision History
- Added support for systemd (thanks to Christopher Reimer). To activate this you - Added support for systemd (thanks to Christopher Reimer). To activate this you
need to add "SDNOTIFY=1" to the 'make' call. need to add "SDNOTIFY=1" to the 'make' call.
2014-04-06: Version 2.1.7 2014-04-13: Version 2.1.7
- No longer logging an error message in DirSizeMB() if the given directory doesn't - No longer logging an error message in DirSizeMB() if the given directory doesn't
exist. This avoids lots of log entries in case several VDRs use the same video exist. This avoids lots of log entries in case several VDRs use the same video
@ -8270,3 +8270,4 @@ Video Disk Recorder Revision History
- Updated the Italian OSD texts (thanks to Diego Pierotto). - Updated the Italian OSD texts (thanks to Diego Pierotto).
- A cCamSlot that has WantsTsData set to true in its constructor now also gets - A cCamSlot that has WantsTsData set to true in its constructor now also gets
the CAT and EMM PIDs data. the CAT and EMM PIDs data.
- Fixed a possible division by zero in frame rate detection.

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 3.6 2014/04/13 11:49:40 kls Exp $ * $Id: remux.c 3.7 2014/04/13 13:48:35 kls Exp $
*/ */
#include "remux.h" #include "remux.h"
@ -1511,7 +1511,12 @@ int cFrameDetector::Analyze(const uchar *Data, int Length)
for (int i = 0; i < numPtsValues; i++) for (int i = 0; i < numPtsValues; i++)
ptsValues[i] = ptsValues[i + 1] - ptsValues[i]; ptsValues[i] = ptsValues[i + 1] - ptsValues[i];
qsort(ptsValues, numPtsValues, sizeof(uint32_t), CmpUint32); 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: // determine frame info:
if (isVideo) { if (isVideo) {
if (abs(Delta - 3600) <= 1) if (abs(Delta - 3600) <= 1)