mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-06-07 07:58:51 +00:00
rtph265pay: Fix reading timestamps from adapter
The code was reading the timestamp from the adapter before pushing the new buffer into it. As a side effect, if the adapter was empty, we'd end up using an older timestamp. In alignment=au, it means that all timestamp was likely one frame in the past, while in alignment=nal, with multiple slices per frame, the first slice would have the timestamp of the previous one.
This commit is contained in:
parent
ff2e5b94b9
commit
0a6e5e439c
1 changed files with 4 additions and 7 deletions
|
@ -1134,16 +1134,13 @@ gst_rtp_h265_pay_handle_buffer (GstRTPBasePayload * basepayload,
|
||||||
dts = GST_BUFFER_DTS (buffer);
|
dts = GST_BUFFER_DTS (buffer);
|
||||||
GST_DEBUG_OBJECT (basepayload, "got %" G_GSIZE_FORMAT " bytes", size);
|
GST_DEBUG_OBJECT (basepayload, "got %" G_GSIZE_FORMAT " bytes", size);
|
||||||
} else {
|
} else {
|
||||||
|
if (buffer)
|
||||||
|
gst_adapter_push (rtph265pay->adapter, buffer);
|
||||||
|
|
||||||
|
/* We want to use the first TS used to construct the following NAL */
|
||||||
dts = gst_adapter_prev_dts (rtph265pay->adapter, NULL);
|
dts = gst_adapter_prev_dts (rtph265pay->adapter, NULL);
|
||||||
pts = gst_adapter_prev_pts (rtph265pay->adapter, NULL);
|
pts = gst_adapter_prev_pts (rtph265pay->adapter, NULL);
|
||||||
if (buffer) {
|
|
||||||
if (!GST_CLOCK_TIME_IS_VALID (dts))
|
|
||||||
dts = GST_BUFFER_DTS (buffer);
|
|
||||||
if (!GST_CLOCK_TIME_IS_VALID (pts))
|
|
||||||
pts = GST_BUFFER_PTS (buffer);
|
|
||||||
|
|
||||||
gst_adapter_push (rtph265pay->adapter, buffer);
|
|
||||||
}
|
|
||||||
size = gst_adapter_available (rtph265pay->adapter);
|
size = gst_adapter_available (rtph265pay->adapter);
|
||||||
/* Nothing to do here if the adapter is empty, e.g. on EOS */
|
/* Nothing to do here if the adapter is empty, e.g. on EOS */
|
||||||
if (size == 0)
|
if (size == 0)
|
||||||
|
|
Loading…
Reference in a new issue