printf("%7.2f A-V:%7.3f aq=%5dKB vq=%5dKB    \r", get_master_clock(is), av_diff, aqsize / 1024, vqsize / 1024);
printf("%7.2f A-V:%7.3f aq=%5dKB vq=%5dKB sq=%5dB    \r", get_master_clock(is), av_diff, aqsize / 1024, vqsize / 1024, sqsize);
static void video_refresh_timer(void *opaque){    VideoState *is = opaque;    VideoPicture *vp;    double actual_delay, delay, sync_threshold, ref_clock, diff;    if (is->video_st) {        if (is->pictq_size == 0) {            /* if no picture, need to wait */            schedule_refresh(is, 1);        } else {            /* dequeue the picture */            vp = &is->pictq[is->pictq_rindex];            /* update current video pts */            is->video_current_pts = vp->pts;            is->video_current_pts_time = av_gettime();            /* compute nominal delay */            delay = vp->pts - is->frame_last_pts;            if (delay <= 0 || delay >= 1.0) {                /* if incorrect delay, use previous one */                delay = is->frame_last_delay;            }            is->frame_last_delay = delay;            is->frame_last_pts = vp->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 */                ref_clock = get_master_clock(is);                diff = vp->pts - ref_clock;                                /* 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 = AV_SYNC_THRESHOLD;                if (delay > sync_threshold)                    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;            /* compute the REAL delay (we need to do that to avoid               long term errors */            actual_delay = is->frame_timer - (av_gettime() / 1000000.0);            if (actual_delay < 0.010) {                /* XXX: should skip picture */                actual_delay = 0.010;            }            /* launch timer for next picture */            schedule_refresh(is, (int)(actual_delay * 1000 + 0.5));#if defined(DEBUG_SYNC)            printf("video: delay=%0.3f actual_delay=%0.3f pts=%0.3f A-V=%f\n",                    delay, actual_delay, vp->pts, -diff);#endif            /* display picture */            video_display(is);                        /* update queue size and signal for next picture */            if (++is->pictq_rindex == VIDEO_PICTURE_QUEUE_SIZE)                is->pictq_rindex = 0;                        SDL_LockMutex(is->pictq_mutex);            is->pictq_size--;            SDL_CondSignal(is->pictq_cond);            SDL_UnlockMutex(is->pictq_mutex);        }    } else if (is->audio_st) {        /* draw the next audio frame */        schedule_refresh(is, 40);        /* if only audio stream, then display the audio bars (better           than nothing, just to test the implementation */                /* display picture */        video_display(is);    } else {        schedule_refresh(is, 100);    }    if (show_status) {        static int64_t last_time;        int64_t cur_time;        int aqsize, vqsize;        double av_diff;                cur_time = av_gettime();        if (!last_time || (cur_time - last_time) >= 500 * 1000) {            aqsize = 0;            vqsize = 0;            if (is->audio_st)                aqsize = is->audioq.size;            if (is->video_st)                vqsize = is->videoq.size;            av_diff = 0;            if (is->audio_st && is->video_st)                av_diff = get_audio_clock(is) - get_video_clock(is);            printf("%7.2f A-V:%7.3f aq=%5dKB vq=%5dKB    \r",                    get_master_clock(is), av_diff, aqsize / 1024, vqsize / 1024);            fflush(stdout);            last_time = cur_time;        }    }}