comparison wmaprodec.c @ 10130:c2d08aedeeed libavcodec

fix handling of packet loss when the output buffer is full
author faust3
date Sat, 05 Sep 2009 10:59:09 +0000
parents 0ffe220e1c80
children a3e378408d5c
comparison
equal deleted inserted replaced
10129:0ffe220e1c80 10130:c2d08aedeeed
1459 s->samples = data; 1459 s->samples = data;
1460 s->samples_start = data; 1460 s->samples_start = data;
1461 s->samples_end = (float*)((int8_t*)data + *data_size); 1461 s->samples_end = (float*)((int8_t*)data + *data_size);
1462 *data_size = 0; 1462 *data_size = 0;
1463 1463
1464 if (!s->output_buffer_full) { 1464 if (!s->output_buffer_full || s->packet_loss) {
1465 s->output_buffer_full = 0;
1465 s->buf_bit_size = buf_size << 3; 1466 s->buf_bit_size = buf_size << 3;
1466 1467
1467 /** sanity check for the buffer length */ 1468 /** sanity check for the buffer length */
1468 if (buf_size < avctx->block_align) 1469 if (buf_size < avctx->block_align)
1469 return 0; 1470 return 0;
1535 save_bits(s, gb, remaining_bits(s, gb), 0); 1536 save_bits(s, gb, remaining_bits(s, gb), 0);
1536 } 1537 }
1537 1538
1538 *data_size = (int8_t *)s->samples - (int8_t *)data; 1539 *data_size = (int8_t *)s->samples - (int8_t *)data;
1539 1540
1540 return (s->output_buffer_full)?0: avctx->block_align; 1541 return (s->output_buffer_full && !s->packet_loss)?0: avctx->block_align;
1541 } 1542 }
1542 1543
1543 /** 1544 /**
1544 *@brief Clear decoder buffers (for seeking). 1545 *@brief Clear decoder buffers (for seeking).
1545 *@param avctx codec context 1546 *@param avctx codec context