hi again,

I did a lot of progress in my audio decoder, but I've still got one
problem: I'm getting twice as many decoded values as expected, and for
each decoded frame, the second half is 0s.

What am I doing wrong?

thank you
jul


My decoding loop:


int count=0;

  while(1)
    {
        // Free old avPacket
        if(avPacket.data!=NULL)
            av_free_packet(&avPacket);

        // Read new avPacket
        if(av_read_frame(pFormatCtx, &avPacket)<0)
        {
            printf("done\n");
            break;//the job is done
        }

        static int16_t output_buf[(AVCODEC_MAX_AUDIO_FRAME_SIZE * 3)/2];
        int len;
        int outputbuffersize = (AVCODEC_MAX_AUDIO_FRAME_SIZE * 3)/2;

        len = avcodec_decode_audio2(pAudioCodecCtx, output_buf,
&outputbuffersize, avPacket.data , avPacket.size);

        count+=len;

        if(len<0)
            return -1;

        if (outputbuffersize <= 0)
            return -1;
        else
        {
                    for(int j=0;j<outputbuffersize;j++)
                            fprintf(outfile,"%d\n",output_buf[j]);
        }

    }
_______________________________________________
libav-user mailing list
[email protected]
https://lists.mplayerhq.hu/mailman/listinfo/libav-user

Reply via email to