[Ffmpeg-devel] [PATCH] MP3 decoding from RTP stream. Getting "invalid new backstep"
Michael Niedermayer
michaelni
Mon Nov 6 17:59:45 CET 2006
Hi
On Mon, Nov 06, 2006 at 05:44:07PM +0100, Martin wrote:
> Hi
>
> Michael Niedermayer wrote:
> > Hi
> >
> > On Mon, Nov 06, 2006 at 03:19:10PM +0100, Martin wrote:
> > [...]
> >
> >>>>>> assert(i <= buf_size - HEADER_SIZE && i>= 0);
> >>>>>> memcpy(s->last_buf + s->last_buf_size, s->gb.buffer + buf_size - HEADER_SIZE - i, i);
> >>>>>>@@ -2503,6 +2508,19 @@ static int mp_decode_frame(MPADecodeCont
> >>>>>> }
> >>>>>> }
> >>>>>>#endif
> >>>>>>+
> >>>>>>+ // zero samples if frame is distorted by overread or backstep
> >>>>>>+ if (discard_frame) {
> >>>>>>+ 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;
> >>>>>>+ }
> >>>>>>+ }
> >>>>>>+ }
> >>>>>>+ }
> >>>>>
> >>>>>
> >>>>>memset(0);
> >>>>>
> >>>>>[...]
> >>>>
> >>>>Is the rest of the patch ok?
> >>>
> >>>
> >>>i think so, but thats just from memory ...
> >>>
> >>>[...]
> >>
> >>The new patch which sets buffers to 0 if 'backstep'occurs which prior
> >>resulted in distorted sound is attached.
> >
> > [...]
> >
> >
> >>+ // zero samples if frame is distorted by overread or backstep
> >>+ if (discard_frame) {
> >>+ 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;
> >>+ }
> >>+ }
> >>+ }
> >>+ }
> >
> >
> > the whole above should be replaced by a if (discard_frame) \n memset(..., 0, ...)
> > as already said
> >
> > [...]
>
> Ok, I didn't see that. Obviously its much better that way... :)
> Attached the updated patch. Hope everything is finally ok now... ;)
looks ok
whoever applies this should test it with a damaged mp3 though
[...]
--
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