comparison libgsm.c @ 6673:679b9ef6f5f3 libavcodec

Make sure some value is always returned via data_size
author mbardiaux
date Fri, 25 Apr 2008 13:25:11 +0000
parents 79984fdb1203
children 5df0c730234d
comparison
equal deleted inserted replaced
6672:79984fdb1203 6673:679b9ef6f5f3
119 }; 119 };
120 120
121 static int libgsm_decode_frame(AVCodecContext *avctx, 121 static int libgsm_decode_frame(AVCodecContext *avctx,
122 void *data, int *data_size, 122 void *data, int *data_size,
123 uint8_t *buf, int buf_size) { 123 uint8_t *buf, int buf_size) {
124 124 *data_size = 0; /* In case of error */
125 if(buf_size < avctx->block_align) return 0; 125 if(buf_size < avctx->block_align) return -1;
126
127 switch(avctx->codec_id) { 126 switch(avctx->codec_id) {
128 case CODEC_ID_GSM: 127 case CODEC_ID_GSM:
129 if(gsm_decode(avctx->priv_data,buf,data)) return -1; 128 if(gsm_decode(avctx->priv_data,buf,data)) return -1;
130 *data_size = GSM_FRAME_SIZE*sizeof(int16_t); 129 *data_size = GSM_FRAME_SIZE*sizeof(int16_t);
131 break; 130 break;