Revision 2e92a34c

View differences:

libavdevice/fbdev.c
189 189
        fbdev->time_frame = av_gettime();
190 190

  
191 191
    /* wait based on the frame rate */
192
    curtime = av_gettime();
193
    delay = fbdev->time_frame - curtime;
194
    av_dlog(avctx,
195
            "time_frame:%"PRId64" curtime:%"PRId64" delay:%"PRId64"\n",
196
            fbdev->time_frame, curtime, delay);
197
    if (delay > 0) {
192
    while (1) {
193
        curtime = av_gettime();
194
        delay = fbdev->time_frame - curtime;
195
        av_dlog(avctx,
196
                "time_frame:%"PRId64" curtime:%"PRId64" delay:%"PRId64"\n",
197
                fbdev->time_frame, curtime, delay);
198
        if (delay <= 0) {
199
            fbdev->time_frame += INT64_C(1000000) * av_q2d(fbdev->time_base);
200
            break;
201
        }
198 202
        if (avctx->flags & AVFMT_FLAG_NONBLOCK)
199 203
            return AVERROR(EAGAIN);
200 204
        ts.tv_sec  =  delay / 1000000;
201 205
        ts.tv_nsec = (delay % 1000000) * 1000;
202 206
        while (nanosleep(&ts, &ts) < 0 && errno == EINTR);
203 207
    }
204
    /* compute the time of the next frame */
205
    fbdev->time_frame += INT64_C(1000000) * av_q2d(fbdev->time_base);
206 208

  
207 209
    if ((ret = av_new_packet(pkt, fbdev->frame_size)) < 0)
208 210
        return ret;

Also available in: Unified diff