gst/playback/gstdecodebin2.c: Check for NULL cases and log them, creating ghostpads can, for example, fail when the p...

Original commit message from CVS:
* gst/playback/gstdecodebin2.c:
(gst_decode_group_control_source_pad), (gst_decode_group_expose):
Check for NULL cases and log them, creating ghostpads can, for example,
fail when the pad returns wrong caps.
* gst/playback/gstplaybin2.c: (perform_eos):
When pushing out the EOS event, collect the return value and warn when
something failed.
This commit is contained in:
Wim Taymans 2008-05-27 10:35:55 +00:00
parent 13d7048f69
commit 514b8fa456
3 changed files with 42 additions and 14 deletions

View file

@ -1,3 +1,14 @@
2008-05-27 Wim Taymans <wim.taymans@collabora.co.uk>
* gst/playback/gstdecodebin2.c:
(gst_decode_group_control_source_pad), (gst_decode_group_expose):
Check for NULL cases and log them, creating ghostpads can, for example,
fail when the pad returns wrong caps.
* gst/playback/gstplaybin2.c: (perform_eos):
When pushing out the EOS event, collect the return value and warn when
something failed.
2008-05-26 Wim Taymans <wim.taymans@collabora.co.uk>
* gst-libs/gst/riff/riff-media.c: (gst_riff_create_video_caps),

View file

@ -1768,9 +1768,12 @@ gst_decode_group_control_source_pad (GstDecodeGroup * group, GstPad * pad)
GROUP_MUTEX_LOCK (group);
/* Create GstDecodePad for the pad */
dpad = gst_decode_pad_new (group, pad, TRUE);
group->endpads = g_list_append (group->endpads, dpad);
if ((dpad = gst_decode_pad_new (group, pad, TRUE))) {
GST_WARNING ("created decode pad %p in group %p", dpad, group);
group->endpads = g_list_append (group->endpads, dpad);
} else {
GST_WARNING ("could not create a decode pad in group %p", group);
}
GROUP_MUTEX_UNLOCK (group);
@ -2006,18 +2009,23 @@ gst_decode_group_expose (GstDecodeGroup * group)
GST_DEBUG_PAD_NAME (dpad->pad));
ghost = gst_ghost_pad_new (padname, dpad->pad);
gst_pad_set_active (ghost, TRUE);
gst_element_add_pad (GST_ELEMENT (dbin), ghost);
group->ghosts = g_list_append (group->ghosts, ghost);
/* the ghostpad can be NULL when we failed to link or some other error
* occured */
if (ghost) {
gst_pad_set_active (ghost, TRUE);
gst_element_add_pad (GST_ELEMENT (dbin), ghost);
group->ghosts = g_list_append (group->ghosts, ghost);
/* 2. emit signal */
GST_DEBUG_OBJECT (dbin, "emitting new-decoded-pad");
g_signal_emit (G_OBJECT (dbin),
gst_decode_bin_signals[SIGNAL_NEW_DECODED_PAD], 0, ghost,
(next == NULL));
GST_DEBUG_OBJECT (dbin, "emitted new-decoded-pad");
} else {
GST_WARNING_OBJECT (dbin, "failed to create ghostpad");
}
g_free (padname);
/* 2. emit signal */
GST_DEBUG_OBJECT (dbin, "emitting new-decoded-pad");
g_signal_emit (G_OBJECT (dbin),
gst_decode_bin_signals[SIGNAL_NEW_DECODED_PAD], 0, ghost,
(next == NULL));
GST_DEBUG_OBJECT (dbin, "emitted new-decoded-pad");
}
/* signal no-more-pads. This allows the application to hook stuff to the

View file

@ -1658,6 +1658,7 @@ no_more_pads_cb (GstElement * decodebin, GstSourceGroup * group)
static void
perform_eos (GstPlayBin * playbin, GstSourceGroup * group)
{
gboolean res;
GstEvent *event;
gint i;
@ -1665,6 +1666,8 @@ perform_eos (GstPlayBin * playbin, GstSourceGroup * group)
event = gst_event_new_eos ();
res = FALSE;
GST_SOURCE_GROUP_LOCK (group);
for (i = 0; i < GST_PLAY_SINK_TYPE_LAST; i++) {
GstSourceSelect *select = &group->selector[i];
@ -1672,12 +1675,18 @@ perform_eos (GstPlayBin * playbin, GstSourceGroup * group)
if (select->selector) {
GST_DEBUG_OBJECT (playbin, "send EOS in selector %s", select->media);
gst_event_ref (event);
gst_pad_push_event (select->srcpad, event);
res |= gst_pad_push_event (select->srcpad, event);
}
}
GST_SOURCE_GROUP_UNLOCK (group);
gst_event_unref (event);
if (!res) {
/* we cannot post an error because we don't know if the EOS failed because
* of a fatal error or simply a pipeline shutdown */
GST_ERROR_OBJECT (playbin, "failed to send EOS");
}
}
static void