[Ffmpeg-devel] MP3 decoding from RTP stream. Getting "invalid new backstep"
Michael Niedermayer
michaelni
Fri Nov 3 11:15:12 CET 2006
Hi
On Fri, Nov 03, 2006 at 10:24:19AM +0100, Martin wrote:
> Hi,
>
> >>>the best way:
> >>>1) Return a value that indicates a problem
> >>>2) Set a flag (which one?) in AVCodecContext that indicates a problem
> >>>3) Changing the buffer values to 0? Is 0 the right value for silence?
> >>
> >>Zero is not a good value as it will cause pops or clicks if the previous
> >>sample has a large value.
> >
> >
> > hmm zeroing a block before the MDCT shouldnt introduce any big
> > discontinuities i think though iam not that good at MDCT related stuff ...
> > one alternative might be to simply use the coeffs fromm the previous
> > block, if that fails too google/citeseer would be the right place to
> > look for audio error concealment
> >
> > [...]
> >
>
> I'm still not able to solve the problem with writing zero to the buffer
> I tried like this in the function mp_decode_frame :
>
> right before returning:
>
> if (discard_frame) {
> //dicard frame is set if an backstep or overread occurs.
> for(i=0;i<nb_frames;i++) {
> for(ch=0;ch<s->nb_channels;ch++) {
> int j;
> for(j=0;j<SBLIMIT;j++) {
> s->sb_samples[ch][i][j] = 0;
> }
> }
> }
> }
>
>
>
> This didn't worked as expected. Also I found another problem caused by
> this point in the huffman_decode() function:
>
> if (pos > end_pos2 && last_pos){
> /* some encoders generate an incorrect size for this
> part. We must go back into the data */
> s_index -= 4;
> skip_bits_long(&s->gb, last_pos - pos);
> av_log(NULL, AV_LOG_INFO, "overread, skip %d enddists:
> %d %d\n", last_pos - pos, end_pos-pos, end_pos2-pos);
> s->frame_distorted = 1;
>
> break;
> }
>
>
> My idea was now to introduce a new flag into the MPADecodeContext:
> int frame_distorted;
>
> Now I set this flag to 0 at the start of decode_frame()
> and set it to 1 when backstep or overread occurs. At the end of
> decode_frame() I check the flag and return -1 if it is set. This is
> working for me. If I send a patch with the new flag, would you include it?
not without understanding why setting sb_samples to 0 doesnt work
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
In the past you could go to a library and read, borrow or copy any book
Today you'd get arrested for mere telling someone where the library is
More information about the ffmpeg-devel
mailing list