From f5495700fb79710cfe155710953bb216c31bacdf Mon Sep 17 00:00:00 2001 From: Mathieu Duponchelle Date: Wed, 22 May 2019 21:44:44 +0200 Subject: [PATCH] basetsmux: don't reset pad on flush_stop This was mistakenly added when porting to aggregator, this restores the old behaviour, by only resetting them when the muxer itself is reset --- gst/mpegtsmux/gstbasetsmux.c | 42 +++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 20 deletions(-) diff --git a/gst/mpegtsmux/gstbasetsmux.c b/gst/mpegtsmux/gstbasetsmux.c index efaf77e909..b1714460eb 100644 --- a/gst/mpegtsmux/gstbasetsmux.c +++ b/gst/mpegtsmux/gstbasetsmux.c @@ -137,7 +137,23 @@ gst_base_ts_mux_pad_reset (GstBaseTsMuxPad * pad) static GstFlowReturn gst_base_ts_mux_pad_flush (GstAggregatorPad * agg_pad, GstAggregator * agg) { - gst_base_ts_mux_pad_reset (GST_BASE_TS_MUX_PAD (agg_pad)); + GList *cur; + GstBaseTsMux *mux = GST_BASE_TS_MUX (agg); + + /* Send initial segments again after a flush-stop, and also resend the + * header sections */ + mux->first = TRUE; + + /* output PAT, SI tables */ + tsmux_resend_pat (mux->tsmux); + tsmux_resend_si (mux->tsmux); + + /* output PMT for each program */ + for (cur = mux->tsmux->programs; cur; cur = cur->next) { + TsMuxProgram *program = (TsMuxProgram *) cur->data; + + tsmux_resend_pmt (program); + } return GST_FLOW_OK; } @@ -285,6 +301,7 @@ gst_base_ts_mux_reset (GstBaseTsMux * mux, gboolean alloc) GstBuffer *buf; GstBaseTsMuxClass *klass = GST_BASE_TS_MUX_GET_CLASS (mux); GHashTable *si_sections = NULL; + GList *l; mux->first = TRUE; mux->last_flow_ret = GST_FLOW_OK; @@ -318,6 +335,10 @@ gst_base_ts_mux_reset (GstBaseTsMux * mux, gboolean alloc) gst_event_replace (&mux->force_key_unit_event, NULL); gst_buffer_replace (&mux->out_buffer, NULL); + for (l = GST_ELEMENT (mux)->sinkpads; l; l = l->next) { + gst_base_ts_mux_pad_reset (GST_BASE_TS_MUX_PAD (l->data)); + } + if (alloc) { g_assert (klass->create_ts_mux); @@ -1325,25 +1346,6 @@ gst_base_ts_mux_sink_event (GstAggregator * agg, GstAggregatorPad * agg_pad, */ break; } - case GST_EVENT_FLUSH_STOP:{ - GList *cur; - - /* Send initial segments again after a flush-stop, and also resend the - * header sections */ - mux->first = TRUE; - - /* output PAT, SI tables */ - tsmux_resend_pat (mux->tsmux); - tsmux_resend_si (mux->tsmux); - - /* output PMT for each program */ - for (cur = mux->tsmux->programs; cur; cur = cur->next) { - TsMuxProgram *program = (TsMuxProgram *) cur->data; - - tsmux_resend_pmt (program); - } - break; - } default: break; }