[FFmpeg-devel] [PATCH] GSM-MS decoder and encoder

Baptiste Coudurier baptiste.coudurier
Fri Apr 25 14:13:45 CEST 2008


Michel Bardiaux wrote:
> Baptiste Coudurier wrote:
>> Hi,
>>
>> Michel Bardiaux wrote:
>>> Baptiste Coudurier wrote:
>>>> Hi,
>>>>
>>>> [...]
>>>>
>>>> Can we please fix this ?
>>>> http://samples.mplayerhq.hu/A-codecs/GSM/sample-gsm-8000.mov
>>>>
>>>> Choose whichever solution you prefer, but this sample should play
>>>> without error message :>
>>>>
>>> Here is a 'permissive' first patch; 13000, 13200, and 0, are accepted
>>> silently.
>>>
> [snip]
> 
>> Multiple frames in a packet from stream 0
>>> [Repeated many many times]
>>>
>>> This is in ffmpeg.c:output_packet and seems to be due to weird pts'es
>>> from input,
>>
>> No, packet contains multiple frames, like error message says.
>>
>> This illustrates another problem with libgsm decoder: data_size must be
>> set to 0 before returning if nothing is output.
>>
>> Also if buf_size < avctx->block_align you should return error (-1) here
>> IMHO.
>>
> Agreed. New patch for review.
> 
> [...]
>
> +    if (avctx->bit_rate != 13000 /* Official */ &&
> +        avctx->bit_rate != 13200 /* Very common */ &&
> +        avctx->bit_rate != 0 /* Unknown, happens in some MOV */ ) {

Something like: "mov does not set bitrate when decoding" might be clearer.

> [...]
>
>  static int libgsm_decode_frame(AVCodecContext *avctx,
>                                 void *data, int *data_size,
>                                 uint8_t *buf, int buf_size) {
> -
> -    if(buf_size < avctx->block_align) return 0;
> -
> +    *data_size = 0; /* In case of error */
> +    if(buf_size < avctx->block_align) return -1;
>      switch(avctx->codec_id) {
>      case CODEC_ID_GSM:
>          if(gsm_decode(avctx->priv_data,buf,data)) return -1;
> 

This must be in a separate commit.

-- 
Baptiste COUDURIER                              GnuPG Key Id: 0x5C1ABAAA
SMARTJOG SAS                                     http://www.smartjog.com
Key fingerprint                 8D77134D20CC9220201FC5DB0AC9325C5C1ABAAA
Phone: +33 1 49966312




More information about the ffmpeg-devel mailing list