summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThibault Saunier <thibault.saunier@osg.samsung.com>2017-01-04 11:21:51 -0300
committerSebastian Dröge <sebastian@centricular.com>2017-01-09 15:49:11 +0200
commit1f243c9a9cb36681e33a734fb73186179d4c9855 (patch)
treeee717da56bc689349454a34ba2401bf5740f5056
parentf11c0ba95212647461ac89c64398c10412e135b1 (diff)
downloadgstreamer-plugins-base-1f243c9a9cb36681e33a734fb73186179d4c9855.tar.gz
encodebin: Fix stream_group_free when creating it went bad
Avoiding trying to use NULL pointers
-rw-r--r--gst/encoding/gstencodebin.c40
1 files changed, 22 insertions, 18 deletions
diff --git a/gst/encoding/gstencodebin.c b/gst/encoding/gstencodebin.c
index 6627c281e..8d9d1969b 100644
--- a/gst/encoding/gstencodebin.c
+++ b/gst/encoding/gstencodebin.c
@@ -1991,23 +1991,24 @@ stream_group_free (GstEncodeBin * ebin, StreamGroup * sgroup)
if (sgroup->restriction_sid != 0)
g_signal_handler_disconnect (sgroup->profile, sgroup->restriction_sid);
- if (ebin->muxer) {
- /* outqueue - Muxer */
- tmppad = gst_element_get_static_pad (sgroup->outqueue, "src");
- pad = gst_pad_get_peer (tmppad);
-
- if (pad) {
- /* Remove muxer request sink pad */
- gst_pad_unlink (tmppad, pad);
- if (GST_PAD_TEMPLATE_PRESENCE (GST_PAD_PAD_TEMPLATE (pad)) ==
- GST_PAD_REQUEST)
- gst_element_release_request_pad (ebin->muxer, pad);
- gst_object_unref (pad);
+ if (sgroup->outqueue) {
+ if (ebin->muxer) {
+ /* outqueue - Muxer */
+ tmppad = gst_element_get_static_pad (sgroup->outqueue, "src");
+ pad = gst_pad_get_peer (tmppad);
+
+ if (pad) {
+ /* Remove muxer request sink pad */
+ gst_pad_unlink (tmppad, pad);
+ if (GST_PAD_TEMPLATE_PRESENCE (GST_PAD_PAD_TEMPLATE (pad)) ==
+ GST_PAD_REQUEST)
+ gst_element_release_request_pad (ebin->muxer, pad);
+ gst_object_unref (pad);
+ }
+ gst_object_unref (tmppad);
}
- gst_object_unref (tmppad);
- }
- if (sgroup->outqueue)
gst_element_set_state (sgroup->outqueue, GST_STATE_NULL);
+ }
if (sgroup->formatter) {
/* capsfilter - formatter - outqueue */
@@ -2015,13 +2016,16 @@ stream_group_free (GstEncodeBin * ebin, StreamGroup * sgroup)
gst_element_set_state (sgroup->outfilter, GST_STATE_NULL);
gst_element_unlink (sgroup->formatter, sgroup->outqueue);
gst_element_unlink (sgroup->outfilter, sgroup->formatter);
- } else {
+ } else if (sgroup->outfilter) {
/* Capsfilter - outqueue */
gst_element_set_state (sgroup->outfilter, GST_STATE_NULL);
gst_element_unlink (sgroup->outfilter, sgroup->outqueue);
}
- gst_element_set_state (sgroup->outqueue, GST_STATE_NULL);
- gst_bin_remove (GST_BIN (ebin), sgroup->outqueue);
+
+ if (sgroup->outqueue) {
+ gst_element_set_state (sgroup->outqueue, GST_STATE_NULL);
+ gst_bin_remove (GST_BIN (ebin), sgroup->outqueue);
+ }
/* streamcombiner - parser - capsfilter */
if (sgroup->parser) {