[FFmpeg-devel] [libav-devel] [PATCH 2/2] wmalosslessdec: reset frame->nb_samples on packet loss
Andreas Cadhalpun
andreas.cadhalpun at googlemail.com
Sun Jul 5 20:42:26 CEST 2015
On 03.07.2015 01:44, Luca Barbato wrote:
> On 03/07/15 01:20, Luca Barbato wrote:
>> On 03/07/15 00:07, Andreas Cadhalpun wrote:
>>> Otherwise a frame with non-zero nb_samples but without any data can be
>>> returned.
>>>
>>> Signed-off-by: Andreas Cadhalpun <Andreas.Cadhalpun at googlemail.com>
>>> ---
>>> libavcodec/wmalosslessdec.c | 1 +
>>> 1 file changed, 1 insertion(+)
>>>
>>> diff --git a/libavcodec/wmalosslessdec.c b/libavcodec/wmalosslessdec.c
>>> index 8094db3..0c85c83 100644
>>> --- a/libavcodec/wmalosslessdec.c
>>> +++ b/libavcodec/wmalosslessdec.c
>>> @@ -1005,6 +1005,7 @@ static int decode_frame(WmallDecodeCtx *s)
>>> if ((ret = ff_get_buffer(s->avctx, s->frame, 0)) < 0) {
>>> /* return an error if no frame could be decoded at all */
>>> s->packet_loss = 1;
>>> + s->frame->nb_samples = 0;
>>> return ret;
>>> }
>>> for (i = 0; i < s->num_channels; i++) {
>>>
>>
>
> Actually it sounds more fishy. How packet_loss is reset w/out filling
> the frame?
Like that:
if (s->packet_loss) {
/* Reset number of saved bits so that the decoder does not start
* to decode incomplete frames in the s->len_prefix == 0 case. */
s->num_saved_bits = 0;
s->packet_loss = 0;
init_put_bits(&s->pb, s->frame_data, MAX_FRAMESIZE);
}
Best regards,
Andreas
More information about the ffmpeg-devel
mailing list