[PATCH] look for valid mpeg frames when decoding instead of =
David Byron none
dbyron
Thu Sep 23 11:05:38 CEST 2010
giving up if a packet doesn't begin with an mpeg frame=0A=
=0A=
---=0A=
Changelog | 1 +=0A=
libavcodec/mpegaudiodec.c | 15 +++++++++------=0A=
2 files changed, 10 insertions(+), 6 deletions(-)=0A=
=0A=
diff --git a/Changelog b/Changelog=0A=
index 263fb74..e6b7ba6 100644=0A=
--- a/Changelog=0A=
+++ b/Changelog=0A=
@@ -4,6 +4,7 @@ releases are sorted from youngest to oldest.=0A=
=0A=
version <next>:=0A=
=0A=
+- look for valid mpeg frames when decoding=0A=
- read all id3v2 tags at the beginning of mp3 files=0A=
- WebM support in Matroska de/muxer=0A=
- low overhead Ogg muxing=0A=
diff --git a/libavcodec/mpegaudiodec.c b/libavcodec/mpegaudiodec.c=0A=
index 769be89..03a4f9e 100644=0A=
--- a/libavcodec/mpegaudiodec.c=0A=
+++ b/libavcodec/mpegaudiodec.c=0A=
@@ -2038,14 +2038,17 @@ static int decode_frame(AVCodecContext * avctx,=0A=
int out_size;=0A=
OUT_INT *out_samples =3D data;=0A=
=0A=
- if(buf_size < HEADER_SIZE)=0A=
- return -1;=0A=
-=0A=
+ while (buf_size >=3D HEADER_SIZE) {=0A=
header =3D AV_RB32(buf);=0A=
- if(ff_mpa_check_header(header) < 0){=0A=
- av_log(avctx, AV_LOG_ERROR, "Header missing\n");=0A=
- return -1;=0A=
+ if(ff_mpa_check_header(header) >=3D 0){=0A=
+ break;=0A=
}=0A=
+ buf++;=0A=
+ buf_size--;=0A=
+ }=0A=
+=0A=
+ if(buf_size < HEADER_SIZE)=0A=
+ return -1;=0A=
=0A=
if (ff_mpegaudio_decode_header((MPADecodeHeader *)s, header) =3D=3D =
1) {=0A=
/* free format: prepare to compute frame size */=0A=
-- =0A=
1.6.0.4=0A=
=0A=
------=_NextPart_000_0A39_01CB5B12.2A07BC00
Content-Type: application/octet-stream;
name="0002-reindent-after-looking-for-valid-mpeg-frames.patch"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: attachment;
filename="0002-reindent-after-looking-for-valid-mpeg-frames.patch"
More information about the ffmpeg-devel
mailing list