aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefano Sabatini <stefano.sabatini-lala@poste.it>2011-03-12 15:24:54 +0100
committerStefano Sabatini <stefano.sabatini-lala@poste.it>2011-04-11 00:14:20 +0200
commitd46c9f83cf495c901e6128ce1042190f620b89c4 (patch)
tree82f7619a770adbb4aaa28baced27fb675d5a0287
parentdf2d5b16ef79f3b55c5d46eded79f791f2f529e0 (diff)
downloadffmpeg-d46c9f83cf495c901e6128ce1042190f620b89c4.tar.gz
fbdev: simplify logic in fbdev_read_packet()
Signed-off-by: Stefano Sabatini <stefano.sabatini-lala@poste.it>
-rw-r--r--libavdevice/fbdev.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/libavdevice/fbdev.c b/libavdevice/fbdev.c
index 4f670e9875..f7fb957e80 100644
--- a/libavdevice/fbdev.c
+++ b/libavdevice/fbdev.c
@@ -189,22 +189,20 @@ static int fbdev_read_packet(AVFormatContext *avctx, AVPacket *pkt)
fbdev->time_frame = av_gettime();
/* wait based on the frame rate */
- while (1) {
- curtime = av_gettime();
- delay = fbdev->time_frame - curtime;
- av_dlog(avctx,
- "time_frame:%"PRId64" curtime:%"PRId64" delay:%"PRId64"\n",
- fbdev->time_frame, curtime, delay);
- if (delay <= 0) {
- fbdev->time_frame += INT64_C(1000000) * av_q2d(fbdev->time_base);
- break;
- }
+ curtime = av_gettime();
+ delay = fbdev->time_frame - curtime;
+ av_dlog(avctx,
+ "time_frame:%"PRId64" curtime:%"PRId64" delay:%"PRId64"\n",
+ fbdev->time_frame, curtime, delay);
+ if (delay > 0) {
if (avctx->flags & AVFMT_FLAG_NONBLOCK)
return AVERROR(EAGAIN);
ts.tv_sec = delay / 1000000;
ts.tv_nsec = (delay % 1000000) * 1000;
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)
return ret;