mpegtsmux: don't error out if downstream fails to handle the newsegment event
If downstream doesn't handle the newsegment event, don't error out (esp. not without posting a proper error message on the bus), but just continue. If there's a problem, we'll find out when we start pushing buffers. https://bugzilla.gnome.org/show_bug.cgi?id=644395
This commit is contained in:
parent
aac497b635
commit
70e71562b7
@ -140,7 +140,7 @@ static gboolean new_packet_cb (guint8 * data, guint len, void *user_data,
|
|||||||
gint64 new_pcr);
|
gint64 new_pcr);
|
||||||
static void release_buffer_cb (guint8 * data, void *user_data);
|
static void release_buffer_cb (guint8 * data, void *user_data);
|
||||||
|
|
||||||
static gboolean mpegtsdemux_prepare_srcpad (MpegTsMux * mux);
|
static void mpegtsdemux_prepare_srcpad (MpegTsMux * mux);
|
||||||
static GstFlowReturn mpegtsmux_collected (GstCollectPads * pads,
|
static GstFlowReturn mpegtsmux_collected (GstCollectPads * pads,
|
||||||
MpegTsMux * mux);
|
MpegTsMux * mux);
|
||||||
static GstPad *mpegtsmux_request_new_pad (GstElement * element,
|
static GstPad *mpegtsmux_request_new_pad (GstElement * element,
|
||||||
@ -656,23 +656,18 @@ mpegtsmux_collected (GstCollectPads * pads, MpegTsMux * mux)
|
|||||||
|
|
||||||
GST_DEBUG_OBJECT (mux, "Pads collected");
|
GST_DEBUG_OBJECT (mux, "Pads collected");
|
||||||
|
|
||||||
if (mux->first) {
|
if (G_UNLIKELY (mux->first)) {
|
||||||
ret = mpegtsmux_create_streams (mux);
|
ret = mpegtsmux_create_streams (mux);
|
||||||
if (G_UNLIKELY (ret != GST_FLOW_OK))
|
if (G_UNLIKELY (ret != GST_FLOW_OK))
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
best = mpegtsmux_choose_best_stream (mux);
|
mpegtsdemux_prepare_srcpad (mux);
|
||||||
|
|
||||||
if (!mpegtsdemux_prepare_srcpad (mux)) {
|
|
||||||
GST_DEBUG_OBJECT (mux, "Failed to send new segment");
|
|
||||||
goto new_seg_fail;
|
|
||||||
}
|
|
||||||
|
|
||||||
mux->first = FALSE;
|
mux->first = FALSE;
|
||||||
} else {
|
|
||||||
best = mpegtsmux_choose_best_stream (mux);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
best = mpegtsmux_choose_best_stream (mux);
|
||||||
|
|
||||||
if (best != NULL) {
|
if (best != NULL) {
|
||||||
TsMuxProgram *prog = best->prog;
|
TsMuxProgram *prog = best->prog;
|
||||||
GstBuffer *buf = best->queued_buf;
|
GstBuffer *buf = best->queued_buf;
|
||||||
@ -732,8 +727,6 @@ mpegtsmux_collected (GstCollectPads * pads, MpegTsMux * mux)
|
|||||||
}
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
new_seg_fail:
|
|
||||||
return GST_FLOW_ERROR;
|
|
||||||
write_fail:
|
write_fail:
|
||||||
/* FIXME: Failed writing data for some reason. Should set appropriate error */
|
/* FIXME: Failed writing data for some reason. Should set appropriate error */
|
||||||
return mux->last_flow_ret;
|
return mux->last_flow_ret;
|
||||||
@ -981,7 +974,7 @@ mpegtsdemux_set_header_on_caps (MpegTsMux * mux)
|
|||||||
gst_caps_unref (caps);
|
gst_caps_unref (caps);
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static void
|
||||||
mpegtsdemux_prepare_srcpad (MpegTsMux * mux)
|
mpegtsdemux_prepare_srcpad (MpegTsMux * mux)
|
||||||
{
|
{
|
||||||
GstEvent *new_seg =
|
GstEvent *new_seg =
|
||||||
@ -992,17 +985,12 @@ mpegtsdemux_prepare_srcpad (MpegTsMux * mux)
|
|||||||
(mux->m2ts_mode ? M2TS_PACKET_LENGTH : NORMAL_TS_PACKET_LENGTH),
|
(mux->m2ts_mode ? M2TS_PACKET_LENGTH : NORMAL_TS_PACKET_LENGTH),
|
||||||
NULL);
|
NULL);
|
||||||
|
|
||||||
// gst_static_pad_template_get_caps (&mpegtsmux_src_factory);
|
|
||||||
|
|
||||||
/* Set caps on src pad from our template and push new segment */
|
/* Set caps on src pad from our template and push new segment */
|
||||||
gst_pad_set_caps (mux->srcpad, caps);
|
gst_pad_set_caps (mux->srcpad, caps);
|
||||||
|
|
||||||
if (!gst_pad_push_event (mux->srcpad, new_seg)) {
|
if (!gst_pad_push_event (mux->srcpad, new_seg)) {
|
||||||
GST_WARNING_OBJECT (mux, "New segment event was not handled");
|
GST_WARNING_OBJECT (mux, "New segment event was not handled downstream");
|
||||||
return FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static GstStateChangeReturn
|
static GstStateChangeReturn
|
||||||
|
Loading…
x
Reference in New Issue
Block a user