<HTML><HEAD>
<META content="text/html; charset=windows-1252" http-equiv=Content-Type></HEAD>
<BODY>
<DIV>
<DIV style="FONT-SIZE: 11pt; FONT-FAMILY: Calibri,sans-serif">This is my sample audio code for reading a fixed size of buffer. <BR>everything works just fine in it even the sync is maintained but the <BR>problem is i get only noise on the left channel and a constant noise on <BR>the right channel along with the audio output.<BR><BR>can anyone have a look at it and show me some solution to remove the noise.<BR>my input file is a AV_SAMPLE_FMT_FLTP with channel_layout = 3.<BR><BR>audio_pkt_size = bufferSize;<BR>while (av_read_frame(m_mpegIn->pFormatCtx, &avpkt)>=0)<BR> {<BR> if(avpkt.stream_index==m_mpegIn->audioStreamIndex)<BR> {<BR> if (!(decoded_frame = avcodec_alloc_frame()))<BR> {<BR> fprintf(stderr, "Could not allocate audio <BR>frame\n");<BR> exit(1);<BR> }<BR> else<BR> {<BR> avcodec_get_frame_defaults(decoded_frame);<BR> }<BR><BR> len = avcodec_decode_audio4(m_mpegIn->pAudioCodecCtx, <BR>decoded_frame, &got_frame, &avpkt);<BR><BR> if (len < 0)<BR> {<BR> // if error, skip frame<BR> audio_pkt_size = 0;<BR> break;<BR> }<BR><BR> if(audio_pkt_size >= decoded_frame->linesize[0])<BR> {<BR> //My calculations for filling remaining buffer<BR><BR> }<BR> buf = buf + <BR>decoded_frame->linesize[0]/*(decoded_frame->nb_samples * <BR>(m_mpegIn->bitsPerSample/8))*/;<BR> avpkt.data += len;<BR> avpkt.dts = avpkt.pts = AV_NOPTS_VALUE;<BR><BR> if( audio_pkt_size > 0 )<BR> {<BR> int size = sizeof(*_buffer);<BR> // No data yet, get more frames<BR> continue;<BR> }<BR> else<BR> {<BR> av_frame_free(&decoded_frame);<BR><BR> return ;<BR> }<BR><BR> }<BR><BR> if (avpkt.data)<BR> av_free_packet(&avpkt);<BR><BR> }</DIV></DIV></BODY></HTML>