oggmux: don't crash on caps being NULL

Also avoid unused variables if debugging is disabled.
This commit is contained in:
Stefan Sauer 2013-03-01 19:14:18 +01:00
parent 7dd2fad888
commit ce626fc3d8

View file

@ -1358,15 +1358,24 @@ gst_ogg_mux_send_headers (GstOggMux * mux)
GstBuffer *buf; GstBuffer *buf;
ogg_packet packet; ogg_packet packet;
GstPad *thepad; GstPad *thepad;
GstCaps *caps;
GstStructure *structure;
GstBuffer *hbuf; GstBuffer *hbuf;
GstMapInfo map; GstMapInfo map;
#ifndef GST_DISABLE_DEBUG
GstCaps *caps;
const gchar *mime_type;
#endif
pad = (GstOggPadData *) walk->data; pad = (GstOggPadData *) walk->data;
thepad = pad->collect.pad; thepad = pad->collect.pad;
caps = gst_pad_get_current_caps (thepad); #ifndef GST_DISABLE_DEBUG
structure = gst_caps_get_structure (caps, 0); if ((caps = gst_pad_get_current_caps (thepad))) {
GstStructure *structure = gst_caps_get_structure (caps, 0);
mime_type = gst_structure_get_name (structure);
gst_caps_unref (caps);
} else {
mime_type = "";
}
#endif
walk = walk->next; walk = walk->next;
@ -1408,8 +1417,7 @@ gst_ogg_mux_send_headers (GstOggMux * mux)
hbuf = gst_ogg_mux_buffer_from_page (mux, &page, FALSE); hbuf = gst_ogg_mux_buffer_from_page (mux, &page, FALSE);
GST_LOG_OBJECT (mux, "swapped out page with mime type %s", GST_LOG_OBJECT (mux, "swapped out page with mime type %s", mime_type);
gst_structure_get_name (structure));
/* quick hack: put video pages at the front. /* quick hack: put video pages at the front.
* Ideally, we would have a settable enum for which Ogg * Ideally, we would have a settable enum for which Ogg
@ -1418,14 +1426,11 @@ gst_ogg_mux_send_headers (GstOggMux * mux)
* one's BOS into the first page, followed by an audio stream's BOS, and * one's BOS into the first page, followed by an audio stream's BOS, and
* only then followed by the remaining video and audio streams?) */ * only then followed by the remaining video and audio streams?) */
if (pad->map.is_video) { if (pad->map.is_video) {
GST_DEBUG_OBJECT (thepad, "putting %s page at the front", GST_DEBUG_OBJECT (thepad, "putting %s page at the front", mime_type);
gst_structure_get_name (structure));
hbufs = g_list_prepend (hbufs, hbuf); hbufs = g_list_prepend (hbufs, hbuf);
} else { } else {
hbufs = g_list_append (hbufs, hbuf); hbufs = g_list_append (hbufs, hbuf);
} }
gst_caps_unref (caps);
} }
/* The Skeleton BOS goes first - even before the video that went first before */ /* The Skeleton BOS goes first - even before the video that went first before */