summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ChangeLog8
-rw-r--r--ext/spc/gstspc.c25
2 files changed, 24 insertions, 9 deletions
diff --git a/ChangeLog b/ChangeLog
index 33032004..83559441 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-11-25 Wim Taymans <wim.taymans@collabora.co.uk>
+
+ Patch by: Jonathan Matthew <notverysmart at gmail dot com>
+
+ * ext/spc/gstspc.c: (gst_spc_dec_sink_event), (spc_setup):
+ Post an error and push EOS when we can't start playback for some reason.
+ also avoid a crash when fed an empty file. Fixes #480543.
+
2008-11-25 Sebastian Dröge <sebastian.droege@collabora.co.uk>
* tests/check/elements/speexresample.c: (test_pipeline):
diff --git a/ext/spc/gstspc.c b/ext/spc/gstspc.c
index b8d7810a..c8ece379 100644
--- a/ext/spc/gstspc.c
+++ b/ext/spc/gstspc.c
@@ -195,20 +195,27 @@ gst_spc_dec_sink_event (GstPad * pad, GstEvent * event)
{
GstSpcDec *spc = GST_SPC_DEC (gst_pad_get_parent (pad));
gboolean result = TRUE;
+ gboolean forward = FALSE;
switch (GST_EVENT_TYPE (event)) {
case GST_EVENT_EOS:
- result = spc_setup (spc);
- break;
- case GST_EVENT_NEWSEGMENT:
- result = FALSE;
+ /* we get EOS when we loaded the complete file, now try to initialize the
+ * decoding */
+ if (!(result = spc_setup (spc))) {
+ /* can't start, post an ERROR and push EOS downstream */
+ GST_ELEMENT_ERROR (spc, STREAM, DEMUX, (NULL),
+ ("can't start playback"));
+ forward = TRUE;
+ }
break;
default:
- result = FALSE;
break;
}
+ if (forward)
+ result = gst_pad_push_event (spc->srcpad, event);
+ else
+ gst_event_unref (event);
- gst_event_unref (event);
gst_object_unref (spc);
return result;
@@ -453,18 +460,18 @@ spc_play (GstPad * pad)
static gboolean
spc_setup (GstSpcDec * spc)
{
- guchar *data = GST_BUFFER_DATA (spc->buf);
spc_tag_info *info;
GstTagList *taglist;
guint64 total_duration;
- if (!spc_negotiate (spc)) {
+ if (!spc->buf || !spc_negotiate (spc)) {
return FALSE;
}
info = &(spc->tag_info);
- spc_tag_get_info (data, GST_BUFFER_SIZE (spc->buf), info);
+ spc_tag_get_info (GST_BUFFER_DATA (spc->buf), GST_BUFFER_SIZE (spc->buf),
+ info);
taglist = gst_tag_list_new ();