History

avcodec/opus/parser: remove duplicate failure path code

James Almer committed 1 year ago

Commit 2f4ec161 parent 37155d61 file · +10 −14Browse files

Unified · Split

libavcodec/opus/parser.c+10−14
@@ -179,9 +179,7 @@ static int opus_parse(AVCodecParserContext *ctx, AVCodecContext *avctx, · 178 unmodified lines
179179 if (avctx->extradata && !s->extradata_parsed) {
180180 if (ff_opus_parse_extradata(avctx, &s->ctx) < 0) {
181181 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;
185183 }
186184 av_freep(&s->ctx.channel_maps);
187185 s->extradata_parsed = 1;
@@ -190,31 +188,29 @@ static int opus_parse(AVCodecParserContext *ctx, AVCodecContext *avctx, · 2 unmodified lines
190188 if (ctx->flags & PARSER_FLAG_COMPLETE_FRAMES) {
191189 next = buf_size;
192190
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;
198193 } else {
199194 next = opus_find_frame_end(ctx, avctx, buf, buf_size, &header_len);
200195
201196 if (s->ts_framing && next != AVERROR_INVALIDDATA &&
202197 ff_combine_frame(pc, next, &buf, &buf_size) < 0) {
203− *poutbuf = NULL;
204− *poutbuf_size = 0;
205− return buf_size;
198+ goto fail;
206199 }
207200
208201 if (next == AVERROR_INVALIDDATA){
209− *poutbuf = NULL;
210− *poutbuf_size = 0;
211− return buf_size;
202+ goto fail;
212203 }
213204 }
214205
215206 *poutbuf = buf + header_len;
216207 *poutbuf_size = buf_size - header_len;
217208 return next;
209+
210+fail:
211+ *poutbuf = NULL;
212+ *poutbuf_size = 0;
213+ return buf_size;
218214 }
219215
220216 const AVCodecParser ff_opus_parser = {

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t