lavc/videotoolboxdec: insert emu-prevention bytes for HEVC as well

Fixes decoding of files with sync-fooling sequences in their PSs.

Signed-off-by: rcombs <rcombs@rcombs.me>
This commit is contained in:
rcombs 2022-04-16 02:52:48 -05:00
parent a465e2c39e
commit 792a9f2406
1 changed files with 4 additions and 4 deletions

View File

@ -246,7 +246,7 @@ CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx)
for (i = 0; i < HEVC_MAX_##T##PS_COUNT; i++) { \ for (i = 0; i < HEVC_MAX_##T##PS_COUNT; i++) { \
if (h->ps.t##ps_list[i]) { \ if (h->ps.t##ps_list[i]) { \
const HEVC##T##PS *lps = (const HEVC##T##PS *)h->ps.t##ps_list[i]->data; \ const HEVC##T##PS *lps = (const HEVC##T##PS *)h->ps.t##ps_list[i]->data; \
vt_extradata_size += 2 + lps->data_size; \ vt_extradata_size += 2 + escape_ps(NULL, lps->data, lps->data_size); \
num_##t##ps++; \ num_##t##ps++; \
} \ } \
} }
@ -369,11 +369,11 @@ CFDataRef ff_videotoolbox_hvcc_extradata_create(AVCodecContext *avctx)
for (i = 0; i < HEVC_MAX_##T##PS_COUNT; i++) { \ for (i = 0; i < HEVC_MAX_##T##PS_COUNT; i++) { \
if (h->ps.t##ps_list[i]) { \ if (h->ps.t##ps_list[i]) { \
const HEVC##T##PS *lps = (const HEVC##T##PS *)h->ps.t##ps_list[i]->data; \ const HEVC##T##PS *lps = (const HEVC##T##PS *)h->ps.t##ps_list[i]->data; \
int size = escape_ps(p + 2, lps->data, lps->data_size); \
/* unsigned int(16) nalUnitLength; */ \ /* unsigned int(16) nalUnitLength; */ \
AV_WB16(p, lps->data_size); \ AV_WB16(p, size); \
/* bit(8*nalUnitLength) nalUnit; */ \ /* bit(8*nalUnitLength) nalUnit; */ \
memcpy(p + 2, lps->data, lps->data_size); \ p += 2 + size; \
p += 2 + lps->data_size; \
} \ } \
} }