From: Andy Wingo Date: Sun, 2 Oct 2005 23:08:35 +0000 (+0000) Subject: ext/flac/gstflacdec.c (gst_flacdec_write): Deal with pad_alloc error returns. X-Git-Tag: RELEASE-0_9_3~1 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=03f926ce2e0c8155003669344a719fe56ae614eb;p=platform%2Fupstream%2Fgst-plugins-good.git ext/flac/gstflacdec.c (gst_flacdec_write): Deal with pad_alloc error returns. Original commit message from CVS: 2005-10-03 Andy Wingo * ext/flac/gstflacdec.c (gst_flacdec_write): Deal with pad_alloc error returns. --- diff --git a/ChangeLog b/ChangeLog index 6ab9459..ec39e44 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-10-03 Andy Wingo + + * ext/flac/gstflacdec.c (gst_flacdec_write): Deal with pad_alloc + error returns. + 2005-10-02 Andy Wingo * configure.ac (GST_PLUGIN_LDFLAGS): Change to be like -base. diff --git a/ext/flac/gstflacdec.c b/ext/flac/gstflacdec.c index 5123884..24c2d8e 100644 --- a/ext/flac/gstflacdec.c +++ b/ext/flac/gstflacdec.c @@ -464,9 +464,14 @@ gst_flacdec_write (const FLAC__SeekableStreamDecoder * decoder, flacdec->frequency = frame->header.sample_rate; } - gst_pad_alloc_buffer (flacdec->srcpad, flacdec->total_samples, + ret = gst_pad_alloc_buffer (flacdec->srcpad, flacdec->total_samples, samples * channels * ((width + 7) >> 3), GST_PAD_CAPS (flacdec->srcpad), &outbuf); + if (ret != GST_FLOW_NOT_LINKED && ret != GST_FLOW_OK) { + GST_DEBUG ("stopping flac decoder engine (%d)", (gint) ret); + return FLAC__STREAM_DECODER_WRITE_STATUS_ABORT; + } + GST_BUFFER_TIMESTAMP (outbuf) = flacdec->total_samples * GST_SECOND / frame->header.sample_rate; GST_BUFFER_DURATION (outbuf) = @@ -786,12 +791,11 @@ gst_flacdec_sink_activate_pull (GstPad * sinkpad, gboolean active) if (active) { /* if we have a scheduler we can start the task */ GST_FLACDEC (GST_OBJECT_PARENT (sinkpad))->offset = 0; - gst_pad_start_task (sinkpad, (GstTaskFunction) gst_flacdec_loop, sinkpad); + return gst_pad_start_task (sinkpad, (GstTaskFunction) gst_flacdec_loop, + sinkpad); } else { - gst_pad_stop_task (sinkpad); + return gst_pad_stop_task (sinkpad); } - - return TRUE; } static GstStateChangeReturn