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

James Almer jamrial at gmail.com
Wed Jan 16 20:15:28 CET 2013


On 16/01/13 7:20 AM, Paul B Mahol wrote:
> Please use git send-mail.

Ok

>> 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) {
> 
> You do not check if extradata have anything valid?

At this point what matters is if there is extradata or not (What differentiates raw packets with 
the other two). Checks for extradata contents come after the LOAS and ADTS checks.

>> +        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");
> 
> This message is really strange.

I didn't write it, but i can change it if you want.

Regards.


More information about the ffmpeg-devel mailing list