mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-24 01:00:37 +00:00
rtph264pay: 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
4add820cce
commit
1f72131781
1 changed files with 8 additions and 8 deletions
|
@ -820,7 +820,9 @@ gst_rtp_h264_pay_payload_nal (GstRTPBasePayload * basepayload,
|
|||
break;
|
||||
}
|
||||
|
||||
GST_DEBUG_OBJECT (rtph264pay, "Processing Buffer with NAL TYPE=%d", nalType);
|
||||
GST_DEBUG_OBJECT (rtph264pay,
|
||||
"Processing Buffer with NAL TYPE=%d %" GST_TIME_FORMAT,
|
||||
nalType, GST_TIME_ARGS (pts));
|
||||
|
||||
/* should set src caps before pushing stuff,
|
||||
* and if we did not see enough SPS/PPS, that may not be the case */
|
||||
|
@ -1046,8 +1048,6 @@ gst_rtp_h264_pay_handle_buffer (GstRTPBasePayload * basepayload,
|
|||
rtph264pay->discont = GST_BUFFER_IS_DISCONT (buffer);
|
||||
GST_DEBUG_OBJECT (basepayload, "got %" G_GSIZE_FORMAT " bytes", size);
|
||||
} else {
|
||||
dts = gst_adapter_prev_dts (rtph264pay->adapter, NULL);
|
||||
pts = gst_adapter_prev_pts (rtph264pay->adapter, NULL);
|
||||
if (buffer) {
|
||||
if (!GST_BUFFER_FLAG_IS_SET (buffer, GST_BUFFER_FLAG_DELTA_UNIT)) {
|
||||
if (gst_adapter_available (rtph264pay->adapter) == 0)
|
||||
|
@ -1069,13 +1069,13 @@ gst_rtp_h264_pay_handle_buffer (GstRTPBasePayload * basepayload,
|
|||
delayed_discont = TRUE;
|
||||
}
|
||||
|
||||
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 (rtph264pay->adapter, buffer);
|
||||
}
|
||||
|
||||
/* We want to use the first TS used to construct the following NAL */
|
||||
dts = gst_adapter_prev_dts (rtph264pay->adapter, NULL);
|
||||
pts = gst_adapter_prev_pts (rtph264pay->adapter, NULL);
|
||||
|
||||
size = gst_adapter_available (rtph264pay->adapter);
|
||||
/* Nothing to do here if the adapter is empty, e.g. on EOS */
|
||||
if (size == 0)
|
||||
|
|
Loading…
Reference in a new issue