[FFmpeg-devel] [PATCH] latmenc: Check for LOAS sync word

Michael Niedermayer michaelni at gmx.at
Tue Jan 15 22:59:30 CET 2013


On Fri, Jan 11, 2013 at 09:27:37PM -0300, James Almer wrote:
> On Fri, Jan 11, 2013 at 4:57 PM, Paul B Mahol <onemda at gmail.com> wrote:
> >
> > On 1/11/13, James Almer <jamrial at gmail.com> wrote:
> > > On 08/01/13 3:14 PM, James Almer wrote:
> > >> Write the packet unaltered if found.
> > >>
> > >> Fixes ticket #1917
> > >>
> > >> Signed-off-by: James Almer <jamrial at gmail.com>
> > >> ---
> > >>  libavformat/latmenc.c |    2 +-
> > >>  1 files changed, 1 insertions(+), 1 deletions(-)
> > >>
> > >> diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c
> > >> index 233eab8..b882382 100644
> > >> --- a/libavformat/latmenc.c
> > >> +++ b/libavformat/latmenc.c
> > >> @@ -149,7 +149,7 @@ static int latm_write_packet(AVFormatContext *s,
> > >> AVPacket *pkt)
> > >>      int i, len;
> > >>      uint8_t loas_header[] = "\x56\xe0\x00";
> > >>
> > >> -    if (s->streams[0]->codec->codec_id == AV_CODEC_ID_AAC_LATM)
> > >> +    if (pkt->size > 2 && pkt->data[0] == 0x56 && (pkt->data[1] >> 4) ==
> > >> 0xe)
> > >>          return ff_raw_write_packet(s, pkt);
> > >>
> > >>      if (pkt->size > 2 && pkt->data[0] == 0xff && (pkt->data[1] >> 4) ==
> > >> 0xf) {
> >
> > Shouldn't  you check exact header and not just part of it?
> >
> > How possible is that valid packet than need header will have first 3 bytes same
> > as loas header?
> 
> As Kunhya said, that's the extent of the header.
> 
> I added a check to compare the size of the packet with the size
> reported at the end
> of the LOAS header (last 13 bits).
> That should make sure only actual LOAS packets pass the entire set of checks.

Iam not sure i understand, are you saying that
a non LOAS packet cannot pass the checks or
a non LOAS packet is unlikekly to pass the checks because you check
more bits ?

I think 24 bits is a bit weak if they arent forbidden to occur


[...]

-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

The greatest way to live with honor in this world is to be what we pretend
to be. -- Socrates
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20130115/6e6de8c9/attachment.asc>


More information about the ffmpeg-devel mailing list