mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-23 14:36:24 +00:00
qtmux: use timestamp delta as duration if possible
https://bugzilla.gnome.org/show_bug.cgi?id=696437
This commit is contained in:
parent
509631f60b
commit
5686512b77
1 changed files with 12 additions and 1 deletions
|
@ -2178,6 +2178,17 @@ gst_qt_mux_add_buffer (GstQTMux * qtmux, GstQTPad * pad, GstBuffer * buf)
|
|||
GST_BUFFER_DTS (buf) = GST_BUFFER_DTS (last_buf);
|
||||
}
|
||||
|
||||
/* duration actually means time delta between samples, so we calculate
|
||||
* the duration based on the difference in DTS or PTS, falling back
|
||||
* to DURATION if the other two don't exist, such as with the last
|
||||
* sample before EOS. */
|
||||
if (last_buf && buf && GST_BUFFER_DTS_IS_VALID (buf)
|
||||
&& GST_BUFFER_DTS_IS_VALID (last_buf))
|
||||
duration = GST_BUFFER_DTS (buf) - GST_BUFFER_DTS (last_buf);
|
||||
else if (last_buf && buf && GST_BUFFER_PTS_IS_VALID (buf)
|
||||
&& GST_BUFFER_PTS_IS_VALID (last_buf))
|
||||
duration = GST_BUFFER_PTS (buf) - GST_BUFFER_PTS (last_buf);
|
||||
else
|
||||
duration = GST_BUFFER_DURATION (last_buf);
|
||||
|
||||
/* for computing the avg bitrate */
|
||||
|
|
Loading…
Reference in a new issue