On Mon, Dec 13, 2021 at 09:56:05PM +0100, sfan5 wrote: > 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).
> From 304d1bbbbbd55e72212c1e907922547d40da240b Mon Sep 17 00:00:00 2001 > From: sfan5 <sf...@live.de> > Date: Mon, 13 Dec 2021 21:01:00 +0100 > Subject: [PATCH] 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). > --- > libavcodec/mediacodecdec.c | 6 ++++++ > 1 file changed, 6 insertions(+) > > 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) { > -- > 2.34.1 > Tested locally without issues. LGTM, thanks. Matthieu _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".