summaryrefslogtreecommitdiff
path: root/libavcodec/opus_parser.c
diff options
context:
space:
mode:
authorJacob Trimble <modmaker@google.com>2018-08-20 11:25:27 -0700
committerJames Almer <jamrial@gmail.com>2018-08-21 19:45:56 -0300
commit7e0df5910ec0f107cd0700d6b9359d29177f1933 (patch)
treee0db775b33a62fb2b14ac997b90d6daaa2940237 /libavcodec/opus_parser.c
parent955a989341a5d43ba88f746b6325f5be35b48146 (diff)
avcodec/opus_parser: Handle complete frames flag.
Signed-off-by: Jacob Trimble <modmaker@google.com> Signed-off-by: James Almer <jamrial@gmail.com>
Diffstat (limited to 'libavcodec/opus_parser.c')
-rw-r--r--libavcodec/opus_parser.c29
1 files 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;