gstreamer/gst
Alicia Boya García 5fcb7f715a qtmux: round to nearest when computing mehd and tkhd duration
This fixes a bug where in some files mehd.fragment_duration is one unit
less than the actual duration of the fragmented movie, as explained below:

mehd.fragment_duration is computed by scaling the end timestamp of
the last frame of the movie in (in nanoseconds) by the movie timescale.

In some situations, the end timestamp is innacurate due to lossy conversion to
fixed point required by GstBuffer upstream.

Take for instance a movie with 3 frames at exactly 3 fps.

$ gst-launch-1.0 -v videotestsrc num-buffers=3 \
  ! video/x-raw, framerate="(fraction)3/1" \
  ! x264enc \
  ! fakesink silent=false

dts: 999:59:59.333333334,  pts: 1000:00:00.000000000, duration: 0:00:00.333333333
dts: 999:59:59.666666667,  pts: 1000:00:00.666666666, duration: 0:00:00.333333334
dts: 1000:00:00.000000000, pts: 1000:00:00.333333333, duration: 0:00:00.333333333

The end timestamp is calculated by qtmux in this way:

end timestamp = last frame DTS + last frame DUR - first frame DTS =
  = 1000:00:00.000000000 + 0:00:00.333333333 - 999:59:59.333333334 =
  = 0:00:00.999999999

qtmux needs to round this timestamp to the declared movie timescale, which can
ameliorate this distortion, but it's important that round-neareast is used;
otherwise it would backfire badly.

Take for example a movie with a timescale of 30 units/s.

0.999999999 s * 30 units/s = 29.999999970 units

A round-floor (as it was done before this patch) would set fragment_duration to
29 units, amplifying the original distorsion from 1 nanosecond up to 33
milliseconds less than the correct value. The greatest distortion would occur
in the case where timescale = framerate, where an entire frame duration would
be subtracted.

Also, rounding is added to tkhd duration computation too, which
potentially has the same problem.

https://bugzilla.gnome.org/show_bug.cgi?id=793959
2018-10-27 13:12:56 +01:00
..
alpha Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
apetag Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
audiofx meson: Replace empty configuration_data() with copy keyword 2018-10-17 14:15:33 +01:00
audioparsers wavpackparse: fix handling of correction streams 2018-09-12 01:05:05 +01:00
auparse Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
autodetect Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
avi avidemux: fix misleading debug line 2018-10-18 15:50:19 +02:00
cutter Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
debugutils Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
deinterlace meson: Replace empty configuration_data() with copy keyword 2018-10-17 14:15:33 +01:00
dtmf Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
effectv Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
equalizer Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
flv flvdemux: Use aac codec-data to adjust channels if needed 2018-10-12 14:35:37 -04:00
flx Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
goom Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
goom2k1 Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
icydemux icydemux: avoid timestamp field initialisation for tag event 2018-05-07 01:25:25 +10:00
id3demux Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
imagefreeze imagefreeze: Allow ANY capsfeatures 2018-09-26 13:30:04 +03:00
interleave Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
isomp4 qtmux: round to nearest when computing mehd and tkhd duration 2018-10-27 13:12:56 +01:00
law Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
level Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
matroska matroska-demux: Fix caps memleak 2018-10-27 10:48:38 +01:00
monoscope Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
multifile splitmuxsink: Do not hardcode frames_of_daily_jam 2018-10-16 16:06:47 +03:00
multipart Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
replaygain Revert "BugFix : Change peak value to normalize audio file with fallback gain" 2018-05-15 10:35:09 +01:00
rtp rtpmp4gdepay: detect broken senders who send AAC with ADTS frames 2018-09-26 12:25:24 +01:00
rtpmanager rtpfunnel: fix shutdown 2018-10-15 14:20:58 +02:00
rtsp rtspsrc: Add support for SET_PARAMETER and GET_PARAMETER using signals 2018-08-16 09:03:42 +03:00
shapewipe Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
smpte Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
spectrum Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
udp udpsrc: print information about bind_error socket error 2018-10-27 13:12:53 +01:00
videobox meson: Replace empty configuration_data() with copy keyword 2018-10-17 14:15:33 +01:00
videocrop Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
videofilter Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
videomixer meson: Replace empty configuration_data() with copy keyword 2018-10-17 14:15:33 +01:00
wavenc Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
wavparse wavparse: Don't set invalid seqnum on events 2018-06-06 07:48:32 +02:00
y4m Meson: Generate pc file for all plugins in good 2018-04-25 11:07:06 +01:00
Makefile.am build: build plugins and examples in parallel where possible 2010-03-29 11:00:57 +01:00
meson.build meson: Add feature options for all plugins 2018-07-27 18:42:54 +05:30