[FFmpeg-devel] [PATCH] latmenc: Check for LOAS sync word
Michael Niedermayer
michaelni at gmx.at
Wed Jan 16 21:17:19 CET 2013
On Wed, Jan 16, 2013 at 04:50:19PM -0300, James Almer wrote:
> Write the packet unaltered if found.
>
> Fixes ticket #1917
>
> Signed-off-by: James Almer <jamrial at gmail.com>
> ---
> libavformat/latmenc.c | 8 +++++++-
> 1 files changed, 7 insertions(+), 1 deletions(-)
>
> diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c
> index 233eab8..d6bdf62 100644
> --- a/libavformat/latmenc.c
> +++ b/libavformat/latmenc.c
> @@ -152,8 +152,14 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt)
> if (s->streams[0]->codec->codec_id == AV_CODEC_ID_AAC_LATM)
> return ff_raw_write_packet(s, pkt);
>
> - if (pkt->size > 2 && pkt->data[0] == 0xff && (pkt->data[1] >> 4) == 0xf) {
> + if (!s->streams[0]->codec->extradata) {
> + if (pkt->size > 2 && pkt->data[0] == 0x56 && (pkt->data[1] >> 4) == 0xe &&
> + (AV_RB16(pkt->data + 1) & 0x1FFF) + 3 == pkt->size)
> + return ff_raw_write_packet(s, pkt);
> +
> + if (pkt->size > 2 && pkt->data[0] == 0xff && (pkt->data[1] >> 4) == 0xf)
> av_log(s, AV_LOG_ERROR, "ADTS header detected - ADTS will not be incorrectly muxed into LATM\n");
> +
> return AVERROR_INVALIDDATA;
> }
If extradata is set then ADTS would be muxed into LATM creating a
invalid output
also the code is indented in a way that does not match the actual
relation of the statements
[...]
--
Michael GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB
The real ebay dictionary, page 3
"Rare item" - "Common item with rare defect or maybe just a lie"
"Professional" - "'Toy' made in china, not functional except as doorstop"
"Experts will know" - "The seller hopes you are not an expert"
-------------- 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/20130116/aba63cca/attachment.asc>
More information about the ffmpeg-devel
mailing list