aboutsummaryrefslogtreecommitdiffstats
path: root/libavdevice/fbdev.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2011-04-11 00:37:00 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-04-11 00:37:52 +0200
commit2e92a34cde07ea145e4b8380259881988cf7edd3 (patch)
tree715badd66362f77ebb071d30a95cb3466f2d75a4 /libavdevice/fbdev.c
parent5381823eb6687400e793189a769be473586b51ce (diff)
downloadffmpeg-2e92a34cde07ea145e4b8380259881988cf7edd3.tar.gz
Revert "fbdev: simplify logic in fbdev_read_packet()"
This change is buggy. This reverts commit d46c9f83cf495c901e6128ce1042190f620b89c4.
Diffstat (limited to 'libavdevice/fbdev.c')
-rw-r--r--libavdevice/fbdev.c18
1 files changed, 10 insertions, 8 deletions
diff --git a/libavdevice/fbdev.c b/libavdevice/fbdev.c
index f7fb957e80..4f670e9875 100644
--- a/libavdevice/fbdev.c
+++ b/libavdevice/fbdev.c
@@ -189,20 +189,22 @@ static int fbdev_read_packet(AVFormatContext *avctx, AVPacket *pkt)
fbdev->time_frame = av_gettime();
/* wait based on the frame rate */
- 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) {
+ 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;
+ }
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;