mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 11:10:37 +00:00
ext/spc/gstspc.c: Post an error and push EOS when we can't start playback for some reason. also avoid a crash when fe...
Original commit message from CVS: 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.
This commit is contained in:
parent
7615d3d8d3
commit
c68ea73e3f
2 changed files with 24 additions and 9 deletions
|
@ -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):
|
||||
|
|
|
@ -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 ();
|
||||
|
||||
|
|
Loading…
Reference in a new issue