mirror of
https://gitee.com/openharmony/third_party_ffmpeg
synced 2024-11-23 03:09:51 +00:00
Fixed the abnormal decryption issue of MP4 audio in cens encryption mode
Signed-off-by: zhenghongda <18810008421@163.com>
This commit is contained in:
parent
a3304e415d
commit
31a6cff6bb
@ -7410,7 +7410,7 @@ static int cenc_filter(MOVContext *mov, AVStream* st, MOVStreamContext *sc, AVPa
|
||||
size_t size;
|
||||
#ifdef OHOS_DRM
|
||||
AV_DrmCencInfo *side_data = NULL;
|
||||
side_data = av_encryption_info_add_side_data_ex(encrypted_sample, &size, side_data);
|
||||
side_data = av_encryption_info_add_side_data_ex(encrypted_sample, &size, side_data, pkt->size);
|
||||
#else
|
||||
uint8_t *side_data = av_encryption_info_add_side_data(encrypted_sample, &size);
|
||||
#endif
|
||||
|
@ -187,7 +187,7 @@ static void av_encryption_info_set_drm_algo(uint32_t algo, AV_DrmCencInfo *cenc_
|
||||
}
|
||||
|
||||
AV_DrmCencInfo *av_encryption_info_add_side_data_ex(const AVEncryptionInfo *info, size_t *side_data_size,
|
||||
AV_DrmCencInfo *cenc_info)
|
||||
AV_DrmCencInfo *cenc_info, int pkt_data_size)
|
||||
{
|
||||
uint32_t i;
|
||||
if ((info == NULL) || (info->key_id_size != AV_DRM_KEY_ID_SIZE) || (info->iv_size > AV_DRM_IV_SIZE) ||
|
||||
@ -216,6 +216,17 @@ AV_DrmCencInfo *av_encryption_info_add_side_data_ex(const AVEncryptionInfo *info
|
||||
cenc_info->sub_samples[i].clear_header_len = info->subsamples[i].bytes_of_clear_data;
|
||||
cenc_info->sub_samples[i].pay_load_len = info->subsamples[i].bytes_of_protected_data;
|
||||
}
|
||||
if ((info->subsample_count == 0) && (info->crypt_byte_block == 0) && (info->skip_byte_block == 0) &&
|
||||
((info->scheme == MKBETAG('c','e','n','s')) || (info->scheme == MKBETAG('s','m','4','r')))) {
|
||||
cenc_info->sub_sample_num = 1; // 1: sub_sample num
|
||||
cenc_info->sub_samples[0].clear_header_len = 0;
|
||||
cenc_info->sub_samples[0].pay_load_len = (pkt_data_size / 16) * 16; // 16: block size
|
||||
if ((pkt_data_size % 16) != 0) { // 16: block size
|
||||
cenc_info->sub_sample_num = 2; // 2: sub_sample num
|
||||
cenc_info->sub_samples[1].clear_header_len = pkt_data_size % 16; // 16: block size
|
||||
cenc_info->sub_samples[1].pay_load_len = 0;
|
||||
}
|
||||
}
|
||||
return cenc_info;
|
||||
}
|
||||
#endif
|
||||
|
@ -222,7 +222,7 @@ uint8_t *av_encryption_info_add_side_data(
|
||||
|
||||
#ifdef OHOS_DRM
|
||||
AV_DrmCencInfo *av_encryption_info_add_side_data_ex(
|
||||
const AVEncryptionInfo *info, size_t *side_data_size, AV_DrmCencInfo *cenc_info);
|
||||
const AVEncryptionInfo *info, size_t *side_data_size, AV_DrmCencInfo *cenc_info, int pkt_data_size);
|
||||
#endif
|
||||
|
||||
/**
|
||||
|
Loading…
Reference in New Issue
Block a user