ext/: Propagate error codes from alloc_buffer too.

Original commit message from CVS:
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_chain_peer):
* ext/theora/theoradec.c: (theora_handle_data_packet):
* ext/vorbis/vorbisdec.c: (vorbis_handle_data_packet):
Propagate error codes from alloc_buffer too.
This commit is contained in:
Wim Taymans 2005-09-29 19:12:44 +00:00
parent 361eb99af9
commit d6825b358a
5 changed files with 51 additions and 32 deletions

View file

@ -1,3 +1,10 @@
2005-09-29 Wim Taymans <wim@fluendo.com>
* ext/ogg/gstoggdemux.c: (gst_ogg_demux_chain_peer):
* ext/theora/theoradec.c: (theora_handle_data_packet):
* ext/vorbis/vorbisdec.c: (vorbis_handle_data_packet):
Propagate error codes from alloc_buffer too.
2005-09-29 Wim Taymans <wim@fluendo.com>
* ext/vorbis/vorbisdec.c: (gst_vorbis_dec_init):

2
common

@ -1 +1 @@
Subproject commit 7caeee4b949b4388927fec7fcf25f767429bde30
Subproject commit e6246e87e86c75b2c9c00d0748f0cd2332295eaa

View file

@ -733,7 +733,6 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet)
GstFlowReturn ret;
GstOggDemux *ogg = pad->ogg;
ret = gst_pad_alloc_buffer (GST_PAD (pad), GST_BUFFER_OFFSET_NONE,
packet->bytes, GST_PAD_CAPS (pad), &buf);
@ -747,6 +746,8 @@ gst_ogg_demux_chain_peer (GstOggPad * pad, ogg_packet * packet)
GST_BUFFER_OFFSET_END (buf) = packet->granulepos;
ret = gst_pad_push (GST_PAD (pad), buf);
if (ret == GST_FLOW_NOT_LINKED)
ret = GST_FLOW_OK;
if (packet->granulepos != -1) {
GstFormat format;

View file

@ -987,7 +987,7 @@ wrong_dimensions:
}
no_buffer:
{
return GST_FLOW_OK;
return result;
}
}

View file

@ -742,6 +742,7 @@ vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet)
{
float **pcm;
guint sample_count;
GstBuffer *out;
GstFlowReturn result;
if (!vd->initialized)
@ -754,18 +755,27 @@ vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet)
if (vorbis_synthesis_blockin (&vd->vd, &vd->vb) < 0)
goto not_accepted;
sample_count = vorbis_synthesis_pcmout (&vd->vd, &pcm);
if (sample_count > 0) {
GstBuffer *out;
/* assume all goes well here */
result = GST_FLOW_OK;
/* count samples ready for reading */
if ((sample_count = vorbis_synthesis_pcmout (&vd->vd, NULL)) == 0)
goto done;
/* alloc buffer for it */
result = gst_pad_alloc_buffer (vd->srcpad, GST_BUFFER_OFFSET_NONE,
sample_count * vd->vi.channels * sizeof (float),
GST_PAD_CAPS (vd->srcpad), &out);
if (result != GST_FLOW_OK)
goto done;
if (result == GST_FLOW_OK) {
float *out_data = (float *) GST_BUFFER_DATA (out);
/* get samples ready for reading now, should be sample_count */
if ((vorbis_synthesis_pcmout (&vd->vd, &pcm)) != sample_count)
goto wrong_samples;
copy_samples (out_data, pcm, sample_count, vd->vi.channels);
/* copy samples in buffer */
copy_samples ((float *) GST_BUFFER_DATA (out), pcm, sample_count,
vd->vi.channels);
GST_BUFFER_OFFSET (out) = vd->granulepos;
if (vd->granulepos != -1) {
@ -777,20 +787,14 @@ vorbis_handle_data_packet (GstVorbisDec * vd, ogg_packet * packet)
}
GST_BUFFER_DURATION (out) = sample_count * GST_SECOND / vd->vi.rate;
result = vorbis_dec_push (vd, out);
if (vd->granulepos != -1)
vd->granulepos += sample_count;
} else {
/* no buffer.. */
result = GST_FLOW_OK;
}
vorbis_synthesis_read (&vd->vd, sample_count);
} else {
/* no samples.. */
result = GST_FLOW_OK;
}
vorbis_synthesis_read (&vd->vd, sample_count);
result = vorbis_dec_push (vd, out);
done:
/* granulepos is the last sample in the packet */
if (packet->granulepos != -1)
vd->granulepos = packet->granulepos;
@ -816,6 +820,13 @@ not_accepted:
(NULL), ("vorbis decoder did not accept data packet"));
return GST_FLOW_ERROR;
}
wrong_samples:
{
gst_buffer_unref (out);
GST_ELEMENT_ERROR (GST_ELEMENT (vd), STREAM, DECODE,
(NULL), ("vorbis decoder reported wrong number of samples"));
return GST_FLOW_ERROR;
}
}
static GstFlowReturn