[FFmpeg-devel] [PATCH 4/4] 8svx: simplify and fix return value.

Michael Niedermayer michaelni at gmx.at
Fri Aug 24 05:24:10 CEST 2012


On Tue, Jul 31, 2012 at 06:34:46PM +0200, Nicolas George wrote:
> Do not rely on avctx->frame_number, use a local variable instead.
> Ensure that the number of samples in the first frame comes from
> an exact number of decoded bytes.
> 
> Signed-off-by: Nicolas George <nicolas.george at normalesup.org>
> ---
>  libavcodec/8svx.c |   10 +++++-----
>  1 file changed, 5 insertions(+), 5 deletions(-)
> 
> 
> Unchanged since last submission.
> 
> 
> diff --git a/libavcodec/8svx.c b/libavcodec/8svx.c
> index c1acc60..147f775 100644
> --- a/libavcodec/8svx.c
> +++ b/libavcodec/8svx.c
> @@ -106,7 +106,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
>                                   int *got_frame_ptr, AVPacket *avpkt)
>  {
>      EightSvxContext *esc = avctx->priv_data;
> -    int n, out_data_size, ret;
> +    int n, out_data_size, ret, nb_start_val = 0;
>      uint8_t *src, *dst;
>  
>      /* decode and interleave the first packet */
> @@ -141,6 +141,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
>                  buf += buf_size / avctx->channels;
>                  dst += n / avctx->channels - 1;
>              }
> +            nb_start_val = avctx->channels;
>          } else {
>              deinterleaved_samples = avpkt->data;
>          }
> @@ -154,7 +155,7 @@ static int eightsvx_decode_frame(AVCodecContext *avctx, void *data,
>  
>      /* get output buffer */
>      av_assert1(!(esc->samples_size % avctx->channels || esc->samples_idx % avctx->channels));
> -    esc->frame.nb_samples = FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx)  / avctx->channels;
> +    esc->frame.nb_samples = (FFMIN(MAX_FRAME_SIZE, esc->samples_size - esc->samples_idx) + nb_start_val) / avctx->channels;

this makes the first frame bigger than MAX_FRAME_SIZE, which looks
quite odd.

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

No snowflake in an avalanche ever feels responsible. -- Voltaire
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20120824/242333e3/attachment.asc>


More information about the ffmpeg-devel mailing list