diff options
author | James Almer <jamrial@gmail.com> | 2013-01-17 01:27:14 +0400 |
---|---|---|
committer | James Almer <jamrial@gmail.com> | 2013-02-25 12:48:14 +0400 |
commit | e6324ccfbd8e3607350df7f46fdeec89ec613ea3 (patch) | |
tree | 844ba71f924742f9396b26f6329c44110b6aa8a2 | |
parent | 8cfd33fd3504e54b040d24745f01c9a16cd6ee4f (diff) |
latmenc: Check for LOAS sync word
Write the packet unaltered if found.
Fixes ticket #1917
Signed-off-by: James Almer <jamrial@gmail.com>
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
(cherry picked from commit b454c64e0311d813fef9c22cf34f83c2ce77ab23)
-rw-r--r-- | libavformat/latmenc.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/libavformat/latmenc.c b/libavformat/latmenc.c index 233eab8382..9dfb4e4fab 100644 --- a/libavformat/latmenc.c +++ b/libavformat/latmenc.c @@ -156,6 +156,15 @@ static int latm_write_packet(AVFormatContext *s, AVPacket *pkt) av_log(s, AV_LOG_ERROR, "ADTS header detected - ADTS will not be incorrectly muxed into LATM\n"); return AVERROR_INVALIDDATA; } + + 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); + else + return AVERROR_INVALIDDATA; + } + if (pkt->size > 0x1fff) goto too_large; |