mirror of
https://github.com/FFmpeg/FFmpeg.git
synced 2024-12-23 12:43:46 +02:00
fbdev: simplify logic in fbdev_read_packet()
Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>
This commit is contained in:
parent
df2d5b16ef
commit
d46c9f83cf
@ -189,22 +189,20 @@ static int fbdev_read_packet(AVFormatContext *avctx, AVPacket *pkt)
|
|||||||
fbdev->time_frame = av_gettime();
|
fbdev->time_frame = av_gettime();
|
||||||
|
|
||||||
/* wait based on the frame rate */
|
/* wait based on the frame rate */
|
||||||
while (1) {
|
curtime = av_gettime();
|
||||||
curtime = av_gettime();
|
delay = fbdev->time_frame - curtime;
|
||||||
delay = fbdev->time_frame - curtime;
|
av_dlog(avctx,
|
||||||
av_dlog(avctx,
|
"time_frame:%"PRId64" curtime:%"PRId64" delay:%"PRId64"\n",
|
||||||
"time_frame:%"PRId64" curtime:%"PRId64" delay:%"PRId64"\n",
|
fbdev->time_frame, curtime, delay);
|
||||||
fbdev->time_frame, curtime, delay);
|
if (delay > 0) {
|
||||||
if (delay <= 0) {
|
|
||||||
fbdev->time_frame += INT64_C(1000000) * av_q2d(fbdev->time_base);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
if (avctx->flags & AVFMT_FLAG_NONBLOCK)
|
if (avctx->flags & AVFMT_FLAG_NONBLOCK)
|
||||||
return AVERROR(EAGAIN);
|
return AVERROR(EAGAIN);
|
||||||
ts.tv_sec = delay / 1000000;
|
ts.tv_sec = delay / 1000000;
|
||||||
ts.tv_nsec = (delay % 1000000) * 1000;
|
ts.tv_nsec = (delay % 1000000) * 1000;
|
||||||
while (nanosleep(&ts, &ts) < 0 && errno == EINTR);
|
while (nanosleep(&ts, &ts) < 0 && errno == EINTR);
|
||||||
}
|
}
|
||||||
|
/* compute the time of the next frame */
|
||||||
|
fbdev->time_frame += INT64_C(1000000) * av_q2d(fbdev->time_base);
|
||||||
|
|
||||||
if ((ret = av_new_packet(pkt, fbdev->frame_size)) < 0)
|
if ((ret = av_new_packet(pkt, fbdev->frame_size)) < 0)
|
||||||
return ret;
|
return ret;
|
||||||
|
Loading…
Reference in New Issue
Block a user