[Live-devel] scheduleNextQOSMeasurement() bug?
Ross Finlayson
finlayson at live555.com
Tue Jan 20 18:11:51 PST 2009
>Hi Ross,I would like to report a possible bug in scheduleNextQOSMeasurement():
>unsigned usecsToDelay = nextQOSMeasurementUSecs < timeNowUSecs ? 0
>: nextQOSMeasurementUSecs - timeNowUSecs;
>I think that should be so:
>unsigned usecsToDelay = nextQOSMeasurementUSecs < timeNowUSecs ?
>qosMeasurementIntervalMS*1000 : nextQOSMeasurementUSecs -
>timeNowUSecs;
>
>because after several minutes, nextQOSMeasurementUSecs exceeds the
>size of sizeof (unsigned long) that is 4294967295.This makes
>qosMeasurementTimerTask =
>env->taskScheduler().scheduleDelayedTask(usecsToDelay,(TaskFunc*)periodicQOSMeasurement,
>(void*)NULL);
>to don't delay periodicQOSMeasurement (usecsToDelay=0).
Yes, you're right; that is a bug.
However, the solution, I think, is just to replace that line with
unsigned usecsToDelay = nextQOSMeasurementUSecs - timeNowUSecs;
because that will work correctly even when "nextQOSMeasurementUSecs"
has wrapped around.
--
Ross Finlayson
Live Networks, Inc.
http://www.live555.com/
More information about the live-devel
mailing list