basetsmux: don't reset pad on flush_stop
authorMathieu Duponchelle <mathieu@centricular.com>
Wed, 22 May 2019 19:44:44 +0000 (21:44 +0200)
committerMathieu Duponchelle <mathieu@centricular.com>
Thu, 30 May 2019 15:20:49 +0000 (17:20 +0200)
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

index efaf77e..b171446 100644 (file)
@@ -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;
   }