Commit 4f150068 authored by Mans Rullgard's avatar Mans Rullgard

avconv: use lrint() for rounding double timestamps

Converting the double to float for lrintf() loses precision when
the value is not exactly representable as a single-precision float.
Apart from being inaccurate, this causes discrepancies in some
configurations due to differences in rounding.

Note that the changed timestamp in the vc1-ism test is a bogus,
made-up value.
Signed-off-by: 's avatarMans Rullgard <mans@mansr.com>
parent 110d0cdc
...@@ -1697,10 +1697,10 @@ static void do_video_out(AVFormatContext *s, ...@@ -1697,10 +1697,10 @@ static void do_video_out(AVFormatContext *s,
if (delta <= -0.6) if (delta <= -0.6)
nb_frames = 0; nb_frames = 0;
else if (delta > 0.6) else if (delta > 0.6)
ost->sync_opts = lrintf(sync_ipts); ost->sync_opts = lrint(sync_ipts);
break; break;
case VSYNC_PASSTHROUGH: case VSYNC_PASSTHROUGH:
ost->sync_opts = lrintf(sync_ipts); ost->sync_opts = lrint(sync_ipts);
break; break;
default: default:
av_assert0(0); av_assert0(0);
......
...@@ -118,4 +118,4 @@ ...@@ -118,4 +118,4 @@
0, 48750000, 48750000, 0, 37440, 0xf0fe8c1c 0, 48750000, 48750000, 0, 37440, 0xf0fe8c1c
0, 49170000, 49170000, 0, 37440, 0xc0036222 0, 49170000, 49170000, 0, 37440, 0xc0036222
0, 49590000, 49590000, 0, 37440, 0x3058385c 0, 49590000, 49590000, 0, 37440, 0x3058385c
0, 49798332, 49798332, 0, 37440, 0x68141016 0, 49798330, 49798330, 0, 37440, 0x68141016
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment