rtponviftimestamp: make sure to set E and T bits on last buffer of lists

Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/5173>
This commit is contained in:
Mathieu Duponchelle 2024-02-16 18:08:36 +01:00 committed by GStreamer Marge Bot
parent b88d69b722
commit 0631a59803
2 changed files with 8 additions and 5 deletions

View file

@ -560,7 +560,7 @@ get_utc_from_offset (GstRtpOnvifTimestamp * self, GstBuffer * buf)
}
static gboolean
handle_buffer (GstRtpOnvifTimestamp * self, GstBuffer * buf)
handle_buffer (GstRtpOnvifTimestamp * self, GstBuffer * buf, gboolean last)
{
GstRTPBuffer rtp = GST_RTP_BUFFER_INIT;
guint8 *data;
@ -669,7 +669,7 @@ handle_buffer (GstRtpOnvifTimestamp * self, GstBuffer * buf)
}
/* Set E if this the last buffer of a contiguous section of recording */
if (self->set_e_bit) {
if (last && self->set_e_bit) {
GST_DEBUG_OBJECT (self, "set E flag");
field |= (1 << 6);
self->set_e_bit = FALSE;
@ -683,7 +683,7 @@ handle_buffer (GstRtpOnvifTimestamp * self, GstBuffer * buf)
}
/* Set T if we have received EOS */
if (self->set_t_bit) {
if (last && self->set_t_bit) {
GST_DEBUG_OBJECT (self, "set T flag");
field |= (1 << 4);
self->set_t_bit = FALSE;
@ -705,7 +705,7 @@ done:
static GstFlowReturn
handle_and_push_buffer (GstRtpOnvifTimestamp * self, GstBuffer * buf)
{
if (!handle_buffer (self, buf)) {
if (!handle_buffer (self, buf, TRUE)) {
gst_buffer_unref (buf);
return GST_FLOW_ERROR;
}
@ -736,13 +736,15 @@ gst_rtp_onvif_timestamp_chain (GstPad * pad, GstObject * parent,
static gboolean
do_handle_buffer (GstBuffer ** buffer, guint idx, GstRtpOnvifTimestamp * self)
{
return handle_buffer (self, *buffer);
return handle_buffer (self, *buffer, idx + 1 == self->current_list_size);
}
/* @buf: (transfer full) */
static GstFlowReturn
handle_and_push_buffer_list (GstRtpOnvifTimestamp * self, GstBufferList * list)
{
self->current_list_size = gst_buffer_list_length (list);
if (!gst_buffer_list_foreach (list, (GstBufferListFunc) do_handle_buffer,
self)) {
gst_buffer_list_unref (list);

View file

@ -73,6 +73,7 @@ struct _GstRtpOnvifTimestamp {
GQueue *event_queue;
GstBuffer *buffer;
GstBufferList *list;
guint current_list_size;
};
struct _GstRtpOnvifTimestampClass {