<div dir="ltr">are you sure that the input source audio dont have any noise?<div><br></div><div>The code looks ok as you are just sending te buffered content to the decode func.</div></div><div class="gmail_extra"><br><br>
<div class="gmail_quote">On Tue, May 13, 2014 at 1:11 AM, Ankush <span dir="ltr"><<a href="mailto:wadkes93@gmail.com" target="_blank">wadkes93@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div>
<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></div><br>_______________________________________________<br>
Libav-user mailing list<br>
<a href="mailto:Libav-user@ffmpeg.org">Libav-user@ffmpeg.org</a><br>
<a href="http://ffmpeg.org/mailman/listinfo/libav-user" target="_blank">http://ffmpeg.org/mailman/listinfo/libav-user</a><br>
<br></blockquote></div><br></div>