So, I suggest adding, to your server code, code that compares the value of 'fPresentationTime" computed your new way,

with the value that would be computed by calling "gettimeofday()", and print out the difference

Thanks, Ross. I assume you mean, if the new presentation time becomes different from wall clock time by a large amount, eg more than 1 second, I should reallign fPresentationTime with wall clock time, like this

    if (fPresentationTime.tv_sec == 0 && fPresentationTime.tv_usec == 0)
    {
        gettimeofday(&fPresentationTime, NULL);
INFO("setPresentationTime: %ld.%06ld\n", fPresentationTime.tv_sec, fPresentationTime.tv_usec);
    }
    else
    {
       // Increment by the sample time
unsigned uSeconds = fPresentationTime.tv_usec + (unsigned)(1000000.0/fMaxFps);
        fPresentationTime.tv_sec += uSeconds/1000000;
        fPresentationTime.tv_usec = uSeconds%1000000;

        //check for basic alignment with 'wall clock' time
        struct timeval wallclocktime;
        gettimeofday(&wallclocktime, NULL);
        if ((wallclocktime.tv_sec > fPresentationTime.tv_sec + 1) ||
                (fPresentationTime.tv_sec > wallclocktime.tv_sec + 1) )
{ //we have drifted too far from wall clock time so need to realign
            fPresentationTime.tv_sec = wallclocktime.tv_sec;
            fPresentationTime.tv_usec = wallclocktime.tv_usec;
INFO("Realigning PresentationTime with wall-clock time: %ld.%06ld\n", fPresentationTime.tv_sec, fPresentationTime.tv_usec);
        }
    }
This seems to work but will need more testing. VLC seems to be very sensitive to presentation time jumps or anomalies.
_______________________________________________
live-devel mailing list
live-devel@lists.live555.com
http://lists.live555.com/mailman/listinfo/live-devel

Reply via email to