From: Nicolas Dufresne Date: Wed, 3 Oct 2018 18:14:17 +0000 (-0400) Subject: rtph265pay: Fix reading timestamps from adapter X-Git-Tag: 1.16.2~248 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=0a6e5e439ce6aefbe8ebcf5bf4d02280c6d248a3;p=platform%2Fupstream%2Fgst-plugins-good.git 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. --- diff --git a/gst/rtp/gstrtph265pay.c b/gst/rtp/gstrtph265pay.c index 812eeab..0cf94ee 100644 --- a/gst/rtp/gstrtph265pay.c +++ b/gst/rtp/gstrtph265pay.c @@ -1134,16 +1134,13 @@ gst_rtp_h265_pay_handle_buffer (GstRTPBasePayload * basepayload, dts = GST_BUFFER_DTS (buffer); GST_DEBUG_OBJECT (basepayload, "got %" G_GSIZE_FORMAT " bytes", size); } 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); 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); /* Nothing to do here if the adapter is empty, e.g. on EOS */ if (size == 0)