Unified · Split
| @@ -179,9 +179,7 @@ static int opus_parse(AVCodecParserContext *ctx, AVCodecContext *avctx, · 178 unmodified lines | ||
| 179 | 179 | if (avctx->extradata && !s->extradata_parsed) { |
| 180 | 180 | if (ff_opus_parse_extradata(avctx, &s->ctx) < 0) { |
| 181 | 181 | av_log(avctx, AV_LOG_ERROR, "Error parsing Ogg extradata.\n"); |
| 182 | − *poutbuf = NULL; | |
| 183 | − *poutbuf_size = 0; | |
| 184 | − return buf_size; | |
| 182 | + goto fail; | |
| 185 | 183 | } |
| 186 | 184 | av_freep(&s->ctx.channel_maps); |
| 187 | 185 | s->extradata_parsed = 1; |
| @@ -190,31 +188,29 @@ static int opus_parse(AVCodecParserContext *ctx, AVCodecContext *avctx, · 2 unmodified lines | ||
| 190 | 188 | if (ctx->flags & PARSER_FLAG_COMPLETE_FRAMES) { |
| 191 | 189 | next = buf_size; |
| 192 | 190 | |
| 193 | − if (set_frame_duration(ctx, avctx, buf, buf_size) < 0) { | |
| 194 | − *poutbuf = NULL; | |
| 195 | − *poutbuf_size = 0; | |
| 196 | − return buf_size; | |
| 197 | − } | |
| 191 | + if (set_frame_duration(ctx, avctx, buf, buf_size) < 0) | |
| 192 | + goto fail; | |
| 198 | 193 | } else { |
| 199 | 194 | next = opus_find_frame_end(ctx, avctx, buf, buf_size, &header_len); |
| 200 | 195 | |
| 201 | 196 | if (s->ts_framing && next != AVERROR_INVALIDDATA && |
| 202 | 197 | ff_combine_frame(pc, next, &buf, &buf_size) < 0) { |
| 203 | − *poutbuf = NULL; | |
| 204 | − *poutbuf_size = 0; | |
| 205 | − return buf_size; | |
| 198 | + goto fail; | |
| 206 | 199 | } |
| 207 | 200 | |
| 208 | 201 | if (next == AVERROR_INVALIDDATA){ |
| 209 | − *poutbuf = NULL; | |
| 210 | − *poutbuf_size = 0; | |
| 211 | − return buf_size; | |
| 202 | + goto fail; | |
| 212 | 203 | } |
| 213 | 204 | } |
| 214 | 205 | |
| 215 | 206 | *poutbuf = buf + header_len; |
| 216 | 207 | *poutbuf_size = buf_size - header_len; |
| 217 | 208 | return next; |
| 209 | + | |
| 210 | +fail: | |
| 211 | + *poutbuf = NULL; | |
| 212 | + *poutbuf_size = 0; | |
| 213 | + return buf_size; | |
| 218 | 214 | } |
| 219 | 215 | |
| 220 | 216 | const AVCodecParser ff_opus_parser = { |