static double compute_target_time(double frame_current_pts, VideoState *is)

{

    double delay, sync_threshold, diff;



    /* compute nominal delay */

    delay = frame_current_pts - is->frame_last_pts;

    if (delay <= 0 || delay >= 10.0) {

        /* if incorrect delay, use previous one */

        delay = is->frame_last_delay;

    } else {

        is->frame_last_delay = delay;

    }

    is->frame_last_pts = frame_current_pts;



    /* update delay to follow master synchronisation source */

    if (((is->av_sync_type == AV_SYNC_AUDIO_MASTER && is->audio_st) ||

         is->av_sync_type == AV_SYNC_EXTERNAL_CLOCK)) {

        /* if video is slave, we try to correct big delays by

           duplicating or deleting a frame */

        diff = get_video_clock(is) - get_master_clock(is);



        /* skip or repeat frame. We take into account the

           delay to compute the threshold. I still don't know

           if it is the best guess */

        sync_threshold = FFMAX(AV_SYNC_THRESHOLD, delay);

        if (fabs(diff) < AV_NOSYNC_THRESHOLD) {

            if (diff <= -sync_threshold)

                delay = 0;

            else if (diff >= sync_threshold)

                delay = 2 * delay;

        }

    }

    is->frame_timer += delay;



    av_log(NULL, AV_LOG_TRACE, "video: delay=%0.3f pts=%0.3f A-V=%f\n",

            delay, frame_current_pts, -diff);



    return is->frame_timer;

}

static double compute_target_time(double frame_current_pts, VideoState *is)

{

    double delay, sync_threshold, diff;



    

    delay = frame_current_pts - is->frame_last_pts;

    if (delay <= 0 || delay >= 10.0) {

        

        delay = is->frame_last_delay;

    } else {

        is->frame_last_delay = delay;

    }

    is->frame_last_pts = frame_current_pts;



    

    if (((is->av_sync_type == AV_SYNC_AUDIO_MASTER && is->audio_st) ||

         is->av_sync_type == AV_SYNC_EXTERNAL_CLOCK)) {

        



        diff = get_video_clock(is) - get_master_clock(is);



        





        sync_threshold = FFMAX(AV_SYNC_THRESHOLD, delay);

        if (fabs(diff) < AV_NOSYNC_THRESHOLD) {

            if (diff <= -sync_threshold)

                delay = 0;

            else if (diff >= sync_threshold)

                delay = 2 * delay;

        }

    }

    is->frame_timer += delay;



    av_log(NULL, AV_LOG_TRACE, "video: delay=%0.3f pts=%0.3f A-V=%f\n",

            delay, frame_current_pts, -diff);



    return is->frame_timer;

}

    double delay, sync_threshold, diff;
static double FUNC_0(double VAR_0, VideoState *VAR_1)

{

    double VAR_2, VAR_3, VAR_4;



    

    VAR_2 = VAR_0 - VAR_1->frame_last_pts;

    if (VAR_2 <= 0 || VAR_2 >= 10.0) {

        

        VAR_2 = VAR_1->frame_last_delay;

    } else {

        VAR_1->frame_last_delay = VAR_2;

    }

    VAR_1->frame_last_pts = VAR_0;



    

    if (((VAR_1->av_sync_type == AV_SYNC_AUDIO_MASTER && VAR_1->audio_st) ||

         VAR_1->av_sync_type == AV_SYNC_EXTERNAL_CLOCK)) {

        



        VAR_4 = get_video_clock(VAR_1) - get_master_clock(VAR_1);



        





        VAR_3 = FFMAX(AV_SYNC_THRESHOLD, VAR_2);

        if (fabs(VAR_4) < AV_NOSYNC_THRESHOLD) {

            if (VAR_4 <= -VAR_3)

                VAR_2 = 0;

            else if (VAR_4 >= VAR_3)

                VAR_2 = 2 * VAR_2;

        }

    }

    VAR_1->frame_timer += VAR_2;



    av_log(NULL, AV_LOG_TRACE, "video: VAR_2=%0.3f pts=%0.3f A-V=%f\n",

            VAR_2, VAR_0, -VAR_4);



    return VAR_1->frame_timer;

}

static double FUNC_0(double VAR_0, VideoState *VAR_1)
{ double VAR_2, VAR_3, VAR_4; VAR_2 = VAR_0 - VAR_1->frame_last_pts; if (VAR_2 <= 0 || VAR_2 >= 10.0) { VAR_2 = VAR_1->frame_last_delay; } else { VAR_1->frame_last_delay = VAR_2; } VAR_1->frame_last_pts = VAR_0; if (((VAR_1->av_sync_type == AV_SYNC_AUDIO_MASTER && VAR_1->audio_st) ||
VAR_1->av_sync_type == AV_SYNC_EXTERNAL_CLOCK)) { VAR_4 = get_video_clock(VAR_1) - get_master_clock(VAR_1); VAR_3 = FFMAX(AV_SYNC_THRESHOLD, VAR_2); if (fabs(VAR_4) < AV_NOSYNC_THRESHOLD) { if (VAR_4 <= -VAR_3)
VAR_2 = 0; else if (VAR_4 >= VAR_3)
VAR_2 = 2 * VAR_2; } } VAR_1->frame_timer += VAR_2; av_log(NULL, AV_LOG_TRACE, "video: VAR_2=%0.3f pts=%0.3f A-V=%f\n",
VAR_2, VAR_0, -VAR_4); return VAR_1->frame_timer; }