amrnbdec: _parse should not return OK if not enough data yet

This commit is contained in:
Mark Nauwelaerts 2012-01-17 11:55:14 +01:00
parent 683f5eeae7
commit 1d71315dc9

View file

@ -257,7 +257,7 @@ gst_amrnbdec_parse (GstAudioDecoder * dec, GstAdapter * adapter,
gst_audio_decoder_get_parse_state (dec, &sync, &eos); gst_audio_decoder_get_parse_state (dec, &sync, &eos);
/* need to peek data to get the size */ /* need to peek data to get the size */
if (gst_adapter_available (adapter) < 1) if (size < 1)
return GST_FLOW_ERROR; return GST_FLOW_ERROR;
data = gst_adapter_peek (adapter, 1); data = gst_adapter_peek (adapter, 1);
@ -280,6 +280,9 @@ gst_amrnbdec_parse (GstAudioDecoder * dec, GstAdapter * adapter,
GST_DEBUG_OBJECT (amrnbdec, "mode %d, block %d", mode, block); GST_DEBUG_OBJECT (amrnbdec, "mode %d, block %d", mode, block);
if (block > size)
return GST_FLOW_UNEXPECTED;
*offset = 0; *offset = 0;
*length = block; *length = block;