diff options
author | Klaus Schmidinger <vdr@tvdr.de> | 2014-04-13 13:50:04 +0200 |
---|---|---|
committer | Klaus Schmidinger <vdr@tvdr.de> | 2014-04-13 13:50:04 +0200 |
commit | 57222002b2b48baa9f5c8d0f253184801ba7200a (patch) | |
tree | f2a36b475a2d623bf0c43084315eb25f641281d7 /remux.c | |
parent | 4fc810191027ffc295b5775e0ff05d3ad60727bd (diff) | |
download | vdr-57222002b2b48baa9f5c8d0f253184801ba7200a.tar.gz vdr-57222002b2b48baa9f5c8d0f253184801ba7200a.tar.bz2 |
Fixed a possible division by zero in frame rate detection
Diffstat (limited to 'remux.c')
-rw-r--r-- | remux.c | 9 |
1 files changed, 7 insertions, 2 deletions
@@ -4,7 +4,7 @@ * See the main source file 'vdr.c' for copyright information and * 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" @@ -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) |