]> git.sesse.net Git - ffmpeg/commitdiff
avcodec/opus_parser: Handle complete frames flag.
authorJacob Trimble <modmaker@google.com>
Mon, 20 Aug 2018 18:25:27 +0000 (11:25 -0700)
committerJames Almer <jamrial@gmail.com>
Tue, 21 Aug 2018 22:45:56 +0000 (19:45 -0300)
Signed-off-by: Jacob Trimble <modmaker@google.com>
Signed-off-by: James Almer <jamrial@gmail.com>
libavcodec/opus_parser.c

index 28b093390099e6dd9a753acd689f2074317bb27d..a145fe7793678d8ec6c5c90efed55b42a176d5cc 100644 (file)
@@ -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;