Unified · Split
| @@ -154,8 +154,12 @@ static int mediacodec_init_bsf(AVCodecContext *avctx) · 153 unmodified lines | ||
| 154 | 154 | ret = snprintf(str, sizeof(str), "h264_metadata=crop_right=%d:crop_bottom=%d", |
| 155 | 155 | crop_right, crop_bottom); |
| 156 | 156 | else if (avctx->codec_id == AV_CODEC_ID_HEVC) |
| 157 | − ret = snprintf(str, sizeof(str), "hevc_metadata=crop_right=%d:crop_bottom=%d", | |
| 158 | − crop_right, crop_bottom); | |
| 157 | + /* Encoder can use CTU size larger than 16x16, so the real crop | |
| 158 | + * margin can be larger than crop_right/crop_bottom. Let bsf figure | |
| 159 | + * out the real crop margin. | |
| 160 | + */ | |
| 161 | + ret = snprintf(str, sizeof(str), "hevc_metadata=width=%d:height=%d", | |
| 162 | + avctx->width, avctx->height); | |
| 159 | 163 | if (ret >= sizeof(str)) |
| 160 | 164 | return AVERROR_BUFFER_TOO_SMALL; |
| 161 | 165 | } |
| @@ -235,7 +239,8 @@ static av_cold int mediacodec_init(AVCodecContext *avctx) · 73 unmodified lines | ||
| 235 | 239 | // Workaround the alignment requirement of mediacodec. We can't do it |
| 236 | 240 | // silently for AV_PIX_FMT_MEDIACODEC. |
| 237 | 241 | if (avctx->pix_fmt != AV_PIX_FMT_MEDIACODEC && |
| 238 | − avctx->codec_id == AV_CODEC_ID_H264) { | |
| 242 | + (avctx->codec_id == AV_CODEC_ID_H264 || | |
| 243 | + avctx->codec_id == AV_CODEC_ID_HEVC)) { | |
| 239 | 244 | s->width = FFALIGN(avctx->width, 16); |
| 240 | 245 | s->height = FFALIGN(avctx->height, 16); |
| 241 | 246 | } else { |