On Fri, Oct 21, 2011 at 05:58:46PM -0400, Justin Ruggles wrote:
> ---
>  libavcodec/tta.c |    9 ++++++---
>  1 files changed, 6 insertions(+), 3 deletions(-)
> 
> diff --git a/libavcodec/tta.c b/libavcodec/tta.c
> index 419091b..093f1bb 100644
> --- a/libavcodec/tta.c
> +++ b/libavcodec/tta.c
> @@ -277,7 +277,7 @@ static int tta_decode_frame(AVCodecContext *avctx,
>      const uint8_t *buf = avpkt->data;
>      int buf_size = avpkt->size;
>      TTAContext *s = avctx->priv_data;
> -    int i;
> +    int i, out_size;
>      int cur_chan = 0, framelen = s->frame_length;
>      int32_t *p;
>  
> @@ -288,7 +288,9 @@ static int tta_decode_frame(AVCodecContext *avctx,
>      if (!s->total_frames && s->last_frame_length)
>          framelen = s->last_frame_length;
>  
> -    if (*data_size < (framelen * s->channels * 2)) {
> +    out_size = framelen * s->channels *
> +               av_get_bytes_per_sample(avctx->sample_fmt);
> +    if (*data_size < out_size) {
>          av_log(avctx, AV_LOG_ERROR, "Output buffer size is too small.\n");
>          return -1;
>      }
> @@ -387,13 +389,14 @@ static int tta_decode_frame(AVCodecContext *avctx,
>              for (p = s->decode_buffer; p < s->decode_buffer + (framelen * 
> s->channels); p++) {
>                  *samples++ = *p;
>              }
> -            *data_size = (uint8_t *)samples - (uint8_t *)data;
>              break;
>          }
>          default:
>              av_log(s->avctx, AV_LOG_ERROR, "Error, only 16bit samples 
> supported!\n");

it's a bit silly returning frame size for this case

>      }
>  
> +    *data_size = out_size;
> +
>      return buf_size;
>  }
>  
> -- 
> 1.7.1
> 
> _______________________________________________
> libav-devel mailing list
> [email protected]
> https://lists.libav.org/mailman/listinfo/libav-devel
_______________________________________________
libav-devel mailing list
[email protected]
https://lists.libav.org/mailman/listinfo/libav-devel

Reply via email to