summaryrefslogtreecommitdiff
path: root/libavcodec/mediacodecdec.c
diff options
context:
space:
mode:
authorsfan5 <sfan5@live.de>2021-12-13 21:56:05 +0100
committerJan Ekström <jeebjp@gmail.com>2021-12-30 18:19:53 +0200
commitb32b32ba89b564e33c6ee0d7a17b80b5e56b6b73 (patch)
treeb74f4fe44ee406bc432aeafb92439a836e1cc5c3 /libavcodec/mediacodecdec.c
parent12f21849e550280c7e577e9958ead9aa42a29584 (diff)
lavc/mediacodecdec: set codec profile and level from extradata for H264+HEVC
This value is later passed to MediaCodec and checked at decoder init. Notably decoding of 10-bit streams before this commit would "work" without returning errors but only return garbage output (on most Android devices).
Diffstat (limited to 'libavcodec/mediacodecdec.c')
-rw-r--r--libavcodec/mediacodecdec.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/libavcodec/mediacodecdec.c b/libavcodec/mediacodecdec.c
index 1cebb3d76d..04d5026e68 100644
--- a/libavcodec/mediacodecdec.c
+++ b/libavcodec/mediacodecdec.c
@@ -155,6 +155,9 @@ static int h264_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
uint8_t *data = NULL;
int data_size = 0;
+ avctx->profile = ff_h264_get_profile(sps);
+ avctx->level = sps->level_idc;
+
if ((ret = h2645_ps_to_nalu(sps->data, sps->data_size, &data, &data_size)) < 0) {
goto done;
}
@@ -236,6 +239,9 @@ static int hevc_set_extradata(AVCodecContext *avctx, FFAMediaFormat *format)
uint8_t *data;
int data_size;
+ avctx->profile = sps->ptl.general_ptl.profile_idc;
+ avctx->level = sps->ptl.general_ptl.level_idc;
+
if ((ret = h2645_ps_to_nalu(vps->data, vps->data_size, &vps_data, &vps_data_size)) < 0 ||
(ret = h2645_ps_to_nalu(sps->data, sps->data_size, &sps_data, &sps_data_size)) < 0 ||
(ret = h2645_ps_to_nalu(pps->data, pps->data_size, &pps_data, &pps_data_size)) < 0) {