mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
tsbase: add a guard with an atomic boolean when flushing
This commit is contained in:
parent
6efd611b8c
commit
e14e310f71
2 changed files with 13 additions and 0 deletions
|
@ -1362,6 +1362,7 @@ mpegts_base_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
gst_event_unref (event);
|
||||
break;
|
||||
case GST_EVENT_FLUSH_START:
|
||||
MPEGTSBASE_SET_FLUSHING (base, TRUE);
|
||||
mpegts_packetizer_flush (base->packetizer);
|
||||
mpegts_base_flush (base);
|
||||
res = GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, event);
|
||||
|
@ -1369,6 +1370,9 @@ mpegts_base_sink_event (GstPad * pad, GstObject * parent, GstEvent * event)
|
|||
case GST_EVENT_FLUSH_STOP:
|
||||
gst_segment_init (&base->segment, GST_FORMAT_UNDEFINED);
|
||||
base->seen_pat = FALSE;
|
||||
res = GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, event);
|
||||
MPEGTSBASE_SET_FLUSHING (base, FALSE);
|
||||
break;
|
||||
/* Passthrough */
|
||||
default:
|
||||
res = GST_MPEGTS_BASE_GET_CLASS (base)->push_event (base, event);
|
||||
|
@ -1399,6 +1403,11 @@ mpegts_base_push (MpegTSBase * base, MpegTSPacketizerPacket * packet,
|
|||
{
|
||||
MpegTSBaseClass *klass = GST_MPEGTS_BASE_GET_CLASS (base);
|
||||
|
||||
if (G_UNLIKELY (MPEGTSBASE_IS_FLUSHING (base))) {
|
||||
GST_LOG_OBJECT (base, "Dropping because flushing");
|
||||
return GST_FLOW_FLUSHING;
|
||||
}
|
||||
|
||||
/* Call implementation */
|
||||
if (G_UNLIKELY (klass->push == NULL)) {
|
||||
GST_ERROR_OBJECT (base, "Class doesn't have a 'push' implementation !");
|
||||
|
|
|
@ -119,6 +119,7 @@ struct _MpegTSBase {
|
|||
guint8 *is_pes;
|
||||
|
||||
gboolean disposed;
|
||||
gboolean flushing; /* ATOMIC */
|
||||
|
||||
/* size of the MpegTSBaseProgram structure, can be overridden
|
||||
* by subclasses if they have their own MpegTSBaseProgram subclasses. */
|
||||
|
@ -183,6 +184,9 @@ struct _MpegTSBaseClass {
|
|||
#define MPEGTS_BIT_UNSET(field, offs) ((field)[(offs) >> 3] &= ~(1 << ((offs) & 0x7)))
|
||||
#define MPEGTS_BIT_IS_SET(field, offs) ((field)[(offs) >> 3] & (1 << ((offs) & 0x7)))
|
||||
|
||||
#define MPEGTSBASE_IS_FLUSHING(self) (g_atomic_int_get (&((self)->flushing)))
|
||||
#define MPEGTSBASE_SET_FLUSHING(self,state) (g_atomic_int_set (&((self)->flushing),state))
|
||||
|
||||
G_GNUC_INTERNAL GType mpegts_base_get_type(void);
|
||||
|
||||
G_GNUC_INTERNAL MpegTSBaseProgram *mpegts_base_get_program (MpegTSBase * base, gint program_number);
|
||||
|
|
Loading…
Reference in a new issue