I am not entirely sure what this flag is supposed to be, since there is no documentation where it is defined. But this was suggested by James Almer as a fix for my encrypted Opus problems and several other codec parsers do the same thing.
From 87dfe4d3d21a824c0fbe71dad2ebc8672b3fd2b4 Mon Sep 17 00:00:00 2001 From: Jacob Trimble <modma...@google.com> Date: Mon, 20 Aug 2018 11:25:27 -0700 Subject: [PATCH] avcodec/opus_parser: Handle complete frames flag.
Signed-off-by: Jacob Trimble <modma...@google.com> --- libavcodec/opus_parser.c | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) diff --git a/libavcodec/opus_parser.c b/libavcodec/opus_parser.c index 28b0933900..a145fe7793 100644 --- a/libavcodec/opus_parser.c +++ b/libavcodec/opus_parser.c @@ -170,19 +170,24 @@ static int opus_parse(AVCodecParserContext *ctx, AVCodecContext *avctx, ParseContext *pc = &s->pc; int next, header_len; - next = opus_find_frame_end(ctx, avctx, buf, buf_size, &header_len); - - if (s->ts_framing && next != AVERROR_INVALIDDATA && - ff_combine_frame(pc, next, &buf, &buf_size) < 0) { - *poutbuf = NULL; - *poutbuf_size = 0; - return buf_size; - } + if (ctx->flags & PARSER_FLAG_COMPLETE_FRAMES) { + next = buf_size; + header_len = 0; + } else { + next = opus_find_frame_end(ctx, avctx, buf, buf_size, &header_len); + + if (s->ts_framing && next != AVERROR_INVALIDDATA && + ff_combine_frame(pc, next, &buf, &buf_size) < 0) { + *poutbuf = NULL; + *poutbuf_size = 0; + return buf_size; + } - if (next == AVERROR_INVALIDDATA){ - *poutbuf = NULL; - *poutbuf_size = 0; - return buf_size; + if (next == AVERROR_INVALIDDATA){ + *poutbuf = NULL; + *poutbuf_size = 0; + return buf_size; + } } *poutbuf = buf + header_len; -- 2.18.0.865.gffc8e1a3cd6-goog
_______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org http://ffmpeg.org/mailman/listinfo/ffmpeg-devel