History

lavf/demux: don't reallocate a AVCodecContext when closing a non-open codec.

This results in an unnecessary ~800k allocation with H.264. A nearby callsite uses avcodec_is_open() to avoid this, so do the same when exiting avformat_find_stream_info().

Dale Curtis committed 2 years ago

Commit a31106d1 parent c7797661 file · +6 −3Browse files

Unified · Split

libavformat/demux.c+6−3
@@ -3102,9 +3102,12 @@ find_stream_info_err: · 3101 unmodified lines
3102 av_freep(&sti->info);3102 av_freep(&sti->info);
3103 }3103 }
3104 3104
3105 err = codec_close(sti);3105 if (avcodec_is_open(sti->avctx)) {
3106 if (err < 0 && ret >= 0)3106 err = codec_close(sti);
3107 ret = err;3107 if (err < 0 && ret >= 0)
3108 ret = err;
3109 }
3110
3108 av_bsf_free(&sti->extract_extradata.bsf);3111 av_bsf_free(&sti->extract_extradata.bsf);
3109 }3112 }
3110 if (ic->pb) {3113 if (ic->pb) {

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