bool onTarget = false;
while (iter != pts_map.end())
{
- bool inRange;
+ bool inRange, inDoubleRange;
if (pts < PTSMAP_THRESHOLD)
inRange = (iter->pts <= pts ||
iter->pts >= (1LL<<33) - PTSMAP_THRESHOLD + pts);
else
inRange = (iter->pts <= pts &&
iter->pts >= pts - PTSMAP_THRESHOLD);
+
+ if (pts < PTSMAP_THRESHOLD*2)
+ inDoubleRange = (iter->pts <= pts ||
+ iter->pts >= (1LL<<33) - PTSMAP_THRESHOLD*2 + pts);
+ else
+ inDoubleRange = (iter->pts <= pts &&
+ iter->pts >= pts - PTSMAP_THRESHOLD*2);
+
if (onTarget)
{
- if (!inRange) break; // We have hit the target
+ if (!inDoubleRange) break; // We have hit the target
}
else
{
- if (inRange) onTarget = true; // We are hot on the trail
+ if (inRange){ onTarget = true; // We are hot on the trail
+ Log::getInstance()->log("Demuxer", Log::DEBUG, "ON TARGET AT %d", iter->frame); }
}
++iter;
}
if (onTarget) ret = iter->frame;
pthread_mutex_unlock(&pts_map_mutex);
if (!onTarget)
+ {
+ Log::getInstance()->log("Demuxer", Log::DEBUG, "FAILED TO FIND FRAME NUMBER for %llu", pts);
return 0;
+ }
else
+ {
+ Log::getInstance()->log("Demuxer", Log::DEBUG, "FOUND FRAME NUMBER %d for %llu", ret, pts);
return ret;
+ }
}
void DemuxerVDR::PESPacketVDR::parseDetails()