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