History

avformat/hevc: Defer initializations in ff_isom_write_hvcc()

Saves initialization of an HEVCDecoderConfigurationRecord when the data is already in ISOBMFF-format or if it is plainly invalid.

Andreas Rheinhardt committed 6 years ago

Commit 1884d881 parent 297d5a11 file · +8 −10Browse files

Unified · Split

libavformat/hevc.c+8−10
@@ -1068,29 +1068,27 @@ int ff_hevc_annexb2mp4_buf(const uint8_t *buf_in, uint8_t **buf_out, · 1067 unmodified lines
10681068 int ff_isom_write_hvcc(AVIOContext *pb, const uint8_t *data,
10691069 int size, int ps_array_completeness)
10701070 {
1071− int ret = 0;
1072− uint8_t *buf, *end, *start = NULL;
10731071 HEVCDecoderConfigurationRecord hvcc;
1074−
1075− hvcc_init(&hvcc);
1072+ uint8_t *buf, *end, *start;
1073+ int ret;
10761074
10771075 if (size < 6) {
10781076 /* We can't write a valid hvcC from the provided data */
1079− ret = AVERROR_INVALIDDATA;
1080− goto end;
1077+ return AVERROR_INVALIDDATA;
10811078 } else if (*data == 1) {
10821079 /* Data is already hvcC-formatted */
10831080 avio_write(pb, data, size);
1084− goto end;
1081+ return 0;
10851082 } else if (!(AV_RB24(data) == 1 || AV_RB32(data) == 1)) {
10861083 /* Not a valid Annex B start code prefix */
1087− ret = AVERROR_INVALIDDATA;
1088− goto end;
1084+ return AVERROR_INVALIDDATA;
10891085 }
10901086
10911087 ret = ff_avc_parse_nal_units_buf(data, &start, &size);
10921088 if (ret < 0)
1093− goto end;
1089+ return ret;
1090+
1091+ hvcc_init(&hvcc);
10941092
10951093 buf = start;
10961094 end = start + size;

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