mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-15 03:45:38 +00:00
speexdec: Don't unmap or finish_frame an invalid GstBuffer
https://bugzilla.gnome.org/show_bug.cgi?id=687464
This commit is contained in:
parent
7cbca3dcd1
commit
8c44361bca
1 changed files with 10 additions and 7 deletions
|
@ -392,6 +392,7 @@ gst_speex_dec_parse_data (GstSpeexDec * dec, GstBuffer * buf)
|
||||||
/* now decode each frame, catering for unknown number of them (e.g. rtp) */
|
/* now decode each frame, catering for unknown number of them (e.g. rtp) */
|
||||||
for (i = 0; i < fpp; i++) {
|
for (i = 0; i < fpp; i++) {
|
||||||
GstBuffer *outbuf;
|
GstBuffer *outbuf;
|
||||||
|
gboolean corrupted = FALSE;
|
||||||
gint ret;
|
gint ret;
|
||||||
|
|
||||||
GST_LOG_OBJECT (dec, "decoding frame %d/%d, %d bits remaining", i, fpp,
|
GST_LOG_OBJECT (dec, "decoding frame %d/%d, %d bits remaining", i, fpp,
|
||||||
|
@ -425,18 +426,15 @@ gst_speex_dec_parse_data (GstSpeexDec * dec, GstBuffer * buf)
|
||||||
} else {
|
} else {
|
||||||
GST_WARNING_OBJECT (dec, "Unexpected end of stream found");
|
GST_WARNING_OBJECT (dec, "Unexpected end of stream found");
|
||||||
}
|
}
|
||||||
gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (dec), NULL, 1);
|
corrupted = TRUE;
|
||||||
gst_buffer_unref (outbuf);
|
|
||||||
} else if (ret == -2) {
|
} else if (ret == -2) {
|
||||||
GST_WARNING_OBJECT (dec, "Decoding error: corrupted stream?");
|
GST_WARNING_OBJECT (dec, "Decoding error: corrupted stream?");
|
||||||
gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (dec), NULL, 1);
|
corrupted = TRUE;
|
||||||
gst_buffer_unref (outbuf);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (bits && speex_bits_remaining (bits) < 0) {
|
if (bits && speex_bits_remaining (bits) < 0) {
|
||||||
GST_WARNING_OBJECT (dec, "Decoding overflow: corrupted stream?");
|
GST_WARNING_OBJECT (dec, "Decoding overflow: corrupted stream?");
|
||||||
gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (dec), NULL, 1);
|
corrupted = TRUE;
|
||||||
gst_buffer_unref (outbuf);
|
|
||||||
}
|
}
|
||||||
if (dec->header->nb_channels == 2)
|
if (dec->header->nb_channels == 2)
|
||||||
speex_decode_stereo_int ((spx_int16_t *) map.data, dec->frame_size,
|
speex_decode_stereo_int ((spx_int16_t *) map.data, dec->frame_size,
|
||||||
|
@ -444,7 +442,12 @@ gst_speex_dec_parse_data (GstSpeexDec * dec, GstBuffer * buf)
|
||||||
|
|
||||||
gst_buffer_unmap (outbuf, &map);
|
gst_buffer_unmap (outbuf, &map);
|
||||||
|
|
||||||
|
if (!corrupted) {
|
||||||
res = gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (dec), outbuf, 1);
|
res = gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (dec), outbuf, 1);
|
||||||
|
} else {
|
||||||
|
res = gst_audio_decoder_finish_frame (GST_AUDIO_DECODER (dec), NULL, 1);
|
||||||
|
gst_buffer_unref (outbuf);
|
||||||
|
}
|
||||||
|
|
||||||
if (res != GST_FLOW_OK) {
|
if (res != GST_FLOW_OK) {
|
||||||
GST_DEBUG_OBJECT (dec, "flow: %s", gst_flow_get_name (res));
|
GST_DEBUG_OBJECT (dec, "flow: %s", gst_flow_get_name (res));
|
||||||
|
|
Loading…
Reference in a new issue