From f5a3d7b497afb4d363aae07aab8bb96061bdfe3a Mon Sep 17 00:00:00 2001 From: OleksandrKvl Date: Tue, 13 Aug 2019 17:50:33 +0300 Subject: [PATCH] pcapparse: fix DISCONT flag setting DISCONT flag should be set only for first packet. Fixes #1047. --- gst/pcapparse/gstpcapparse.c | 10 ++++++++++ gst/pcapparse/gstpcapparse.h | 1 + 2 files changed, 11 insertions(+) diff --git a/gst/pcapparse/gstpcapparse.c b/gst/pcapparse/gstpcapparse.c index 3ea656b2f9..8a60cdad6c 100644 --- a/gst/pcapparse/gstpcapparse.c +++ b/gst/pcapparse/gstpcapparse.c @@ -325,6 +325,7 @@ gst_pcap_parse_reset (GstPcapParse * self) self->cur_ts = GST_CLOCK_TIME_NONE; self->base_ts = GST_CLOCK_TIME_NONE; self->newsegment_sent = FALSE; + self->first_packet = TRUE; gst_adapter_clear (self->adapter); } @@ -537,6 +538,15 @@ gst_pcap_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer) } else { out_buf = gst_buffer_new (); } + + /* only first packet should have DISCONT flag */ + if (G_LIKELY (!self->first_packet)) { + GST_BUFFER_FLAG_UNSET (out_buf, GST_BUFFER_FLAG_DISCONT); + } else { + GST_BUFFER_FLAG_SET (out_buf, GST_BUFFER_FLAG_DISCONT); + self->first_packet = FALSE; + } + gst_adapter_flush (self->adapter, self->cur_packet_size - offset - payload_size); diff --git a/gst/pcapparse/gstpcapparse.h b/gst/pcapparse/gstpcapparse.h index 6fb39a43df..5feb4c661c 100644 --- a/gst/pcapparse/gstpcapparse.h +++ b/gst/pcapparse/gstpcapparse.h @@ -85,6 +85,7 @@ struct _GstPcapParse GstPcapParseLinktype linktype; gboolean newsegment_sent; + gboolean first_packet; }; struct _GstPcapParseClass