pcapparse: fix DISCONT flag setting

DISCONT flag should be set only for first packet.
Fixes #1047.
This commit is contained in:
OleksandrKvl 2019-08-13 17:50:33 +03:00
parent e2e86658f2
commit f5a3d7b497
2 changed files with 11 additions and 0 deletions

View file

@ -325,6 +325,7 @@ gst_pcap_parse_reset (GstPcapParse * self)
self->cur_ts = GST_CLOCK_TIME_NONE; self->cur_ts = GST_CLOCK_TIME_NONE;
self->base_ts = GST_CLOCK_TIME_NONE; self->base_ts = GST_CLOCK_TIME_NONE;
self->newsegment_sent = FALSE; self->newsegment_sent = FALSE;
self->first_packet = TRUE;
gst_adapter_clear (self->adapter); gst_adapter_clear (self->adapter);
} }
@ -537,6 +538,15 @@ gst_pcap_parse_chain (GstPad * pad, GstObject * parent, GstBuffer * buffer)
} else { } else {
out_buf = gst_buffer_new (); 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, gst_adapter_flush (self->adapter,
self->cur_packet_size - offset - payload_size); self->cur_packet_size - offset - payload_size);

View file

@ -85,6 +85,7 @@ struct _GstPcapParse
GstPcapParseLinktype linktype; GstPcapParseLinktype linktype;
gboolean newsegment_sent; gboolean newsegment_sent;
gboolean first_packet;
}; };
struct _GstPcapParseClass struct _GstPcapParseClass