The standard only defined configurationVersion 1. configurationVersion 0 is for backward compatibility predates the standard. This patch reduces the chance that some malformated streams being detected as hvcC.
Showing the changes to libavcodec (1 of 1 file). Show all
Unified · Split
| @@ -86,11 +86,11 @@ int ff_hevc_decode_extradata(const uint8_t *data, int size, HEVCParamSets *ps, · 85 unmodified lines | ||
| 86 | 86 | |
| 87 | 87 | bytestream2_init(&gb, data, size); |
| 88 | 88 | |
| 89 | − if (size > 3 && (data[0] || data[1] || data[2] > 1)) { | |
| 90 | − /* It seems the extradata is encoded as hvcC format. | |
| 91 | − * Temporarily, we support configurationVersion==0 until 14496-15 3rd | |
| 92 | − * is finalized. When finalized, configurationVersion will be 1 and we | |
| 93 | − * can recognize hvcC by checking if avctx->extradata[0]==1 or not. */ | |
| 89 | + /* data[0] == 1 is configurationVersion from 14496-15. | |
| 90 | + * data[0] == 0 is for backward compatibility predates the standard. | |
| 91 | + */ | |
| 92 | + if (size > 3 && ((data[0] == 1) || (data[0] == 0 && (data[1] || data[2] > 1)))) { | |
| 93 | + /* It seems the extradata is encoded as hvcC format. */ | |
| 94 | 94 | int i, j, num_arrays, nal_len_size; |
| 95 | 95 | |
| 96 | 96 | *is_nalff = 1; |