Also add more debug logging. Fixes #694553.
* whichever happens first.
*/
g_atomic_int_set (&adder->flush_stop_pending, TRUE);
* whichever happens first.
*/
g_atomic_int_set (&adder->flush_stop_pending, TRUE);
+ GST_DEBUG_OBJECT (adder, "mark pending flush stop event");
}
GST_DEBUG_OBJECT (adder, "handling seek event: %" GST_PTR_FORMAT, event);
}
GST_DEBUG_OBJECT (adder, "handling seek event: %" GST_PTR_FORMAT, event);
if (g_atomic_int_compare_and_exchange (&adder->flush_stop_pending,
TRUE, FALSE)) {
GST_DEBUG_OBJECT (adder, "pending flush stop");
if (g_atomic_int_compare_and_exchange (&adder->flush_stop_pending,
TRUE, FALSE)) {
GST_DEBUG_OBJECT (adder, "pending flush stop");
- gst_pad_push_event (adder->srcpad, gst_event_new_flush_stop (TRUE));
+ if (!gst_pad_push_event (adder->srcpad,
+ gst_event_new_flush_stop (TRUE))) {
+ GST_WARNING_OBJECT (adder, "Sending flush stop event failed");
+ }
event = NULL;
}
case GST_EVENT_FLUSH_START:
event = NULL;
}
case GST_EVENT_FLUSH_START:
- /* ensure that we'll eventually send a flush-stop, when we have received a
- * flush-start (e.g. after a flushing seek directly sent to an element) */
- if (g_atomic_int_compare_and_exchange (&adder->flush_stop_pending,
- FALSE, TRUE)) {
- /* discard flush start events, as we forwarded one already when handing the
- * flushing seek on the sink pad */
- discard = TRUE;
- }
+ /* discard flush start events, as we forwarded one already when handing the
+ * flushing seek on the sink pad */
+ g_atomic_int_set (&adder->need_flush_stop, TRUE);
+ discard = TRUE;
+ GST_DEBUG_OBJECT (pad->pad, "eating flush start");
break;
case GST_EVENT_FLUSH_STOP:
/* we received a flush-stop. We will only forward it when
break;
case GST_EVENT_FLUSH_STOP:
/* we received a flush-stop. We will only forward it when
* see FIXME in gst_adder_collected() */
g_atomic_int_set (&adder->new_segment_pending, TRUE);
}
* see FIXME in gst_adder_collected() */
g_atomic_int_set (&adder->new_segment_pending, TRUE);
}
+ if (g_atomic_int_compare_and_exchange (&adder->need_flush_stop,
+ TRUE, FALSE)) {
+ /* ensure that we'll eventually send a flush-stop
+ * (e.g. after a flushing seek directly sent to an upstream element) */
+ g_atomic_int_set (&adder->flush_stop_pending, TRUE);
+ GST_DEBUG_OBJECT (adder, "mark pending flush stop event");
+ }
discard = TRUE;
break;
default:
discard = TRUE;
break;
default:
if (G_UNLIKELY (adder->func == NULL))
goto not_negotiated;
if (G_UNLIKELY (adder->func == NULL))
goto not_negotiated;
+ if (g_atomic_int_compare_and_exchange (&adder->flush_stop_pending,
+ TRUE, FALSE)) {
+ GST_INFO_OBJECT (adder->srcpad, "send pending flush stop event");
+ if (!gst_pad_push_event (adder->srcpad, gst_event_new_flush_stop (TRUE))) {
+ GST_WARNING_OBJECT (adder->srcpad, "Sending flush stop event failed");
+ }
+ }
+
if (adder->send_stream_start) {
gchar s_id[32];
if (adder->send_stream_start) {
gchar s_id[32];
+ GST_INFO_OBJECT (adder->srcpad, "send pending stream start event");
/* stream-start (FIXME: create id based on input ids) */
g_snprintf (s_id, sizeof (s_id), "adder-%08x", g_random_int ());
/* stream-start (FIXME: create id based on input ids) */
g_snprintf (s_id, sizeof (s_id), "adder-%08x", g_random_int ());
- gst_pad_push_event (adder->srcpad, gst_event_new_stream_start (s_id));
+ if (!gst_pad_push_event (adder->srcpad, gst_event_new_stream_start (s_id))) {
+ GST_WARNING_OBJECT (adder->srcpad, "Sending stream start event failed");
+ }
adder->send_stream_start = FALSE;
}
adder->send_stream_start = FALSE;
}
GstEvent *caps_event;
caps_event = gst_event_new_caps (adder->current_caps);
GstEvent *caps_event;
caps_event = gst_event_new_caps (adder->current_caps);
- GST_INFO_OBJECT (adder, "caps event %" GST_PTR_FORMAT, caps_event);
- gst_pad_push_event (adder->srcpad, caps_event);
+ GST_INFO_OBJECT (adder->srcpad, "send pending caps event %" GST_PTR_FORMAT,
+ caps_event);
+ if (!gst_pad_push_event (adder->srcpad, caps_event)) {
+ GST_WARNING_OBJECT (adder->srcpad, "Sending caps event failed");
+ }
adder->send_caps = FALSE;
}
adder->send_caps = FALSE;
}
- if (g_atomic_int_compare_and_exchange (&adder->flush_stop_pending,
- TRUE, FALSE)) {
- GST_DEBUG_OBJECT (adder, "pending flush stop");
- gst_pad_push_event (adder->srcpad, gst_event_new_flush_stop (TRUE));
- }
-
/* get available bytes for reading, this can be 0 which could mean empty
* buffers or EOS, which we will catch when we loop over the pads. */
outsize = gst_collect_pads_available (pads);
/* get available bytes for reading, this can be 0 which could mean empty
* buffers or EOS, which we will catch when we loop over the pads. */
outsize = gst_collect_pads_available (pads);
}
adder->offset = gst_util_uint64_scale (adder->segment.position,
rate, GST_SECOND);
}
adder->offset = gst_util_uint64_scale (adder->segment.position,
rate, GST_SECOND);
- GST_INFO_OBJECT (adder, "seg_start %" G_GUINT64_FORMAT ", seg_end %"
- G_GUINT64_FORMAT, adder->segment.start, adder->segment.stop);
- GST_INFO_OBJECT (adder, "timestamp %" G_GINT64_FORMAT ",new offset %"
- G_GINT64_FORMAT, adder->segment.position, adder->offset);
-
+ GST_INFO_OBJECT (adder->srcpad, "sending pending new segment event %"
+ GST_PTR_FORMAT, adder->segment);
if (event) {
if (!gst_pad_push_event (adder->srcpad, event)) {
GST_WARNING_OBJECT (adder->srcpad, "Sending new segment event failed");
if (event) {
if (!gst_pad_push_event (adder->srcpad, event)) {
GST_WARNING_OBJECT (adder->srcpad, "Sending new segment event failed");
volatile gboolean wait_for_new_segment;
/* src event handling */
volatile gboolean flush_stop_pending;
volatile gboolean wait_for_new_segment;
/* src event handling */
volatile gboolean flush_stop_pending;
+ volatile gboolean need_flush_stop;
/* current caps */
GstCaps *current_caps;
/* current caps */
GstCaps *current_caps;