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 | bytestream2_init(&gb, data, size); | 87 | bytestream2_init(&gb, data, size); |
| 88 | 88 | ||
| 89 | if (size > 3 && (data[0] || data[1] || data[2] > 1)) { | 89 | /* data[0] == 1 is configurationVersion from 14496-15. |
| 90 | /* It seems the extradata is encoded as hvcC format. | 90 | * data[0] == 0 is for backward compatibility predates the standard. |
| 91 | * Temporarily, we support configurationVersion==0 until 14496-15 3rd | 91 | */ |
| 92 | * is finalized. When finalized, configurationVersion will be 1 and we | 92 | if (size > 3 && ((data[0] == 1) || (data[0] == 0 && (data[1] || data[2] > 1)))) { |
| 93 | * can recognize hvcC by checking if avctx->extradata[0]==1 or not. */ | 93 | /* It seems the extradata is encoded as hvcC format. */ |
| 94 | int i, j, num_arrays, nal_len_size; | 94 | int i, j, num_arrays, nal_len_size; |
| 95 | 95 | ||
| 96 | *is_nalff = 1; | 96 | *is_nalff = 1; |