Fixes:
51935d59
temporal_id check is valid only if the num_temporal_layers is set (>0).
When num_temporal_layers is 0, we shouldn't check temporal_id and return
error.
Signed-off-by: Boyuan Zhang <boyuan.zhang@amd.com>
Reviewed-by: Thong Thai <thong.thai@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12463>
context->desc.h264enc.rate_ctrl[temporal_id].target_bitrate =
rc->bits_per_second * (rc->target_percentage / 100.0);
- if (temporal_id >= context->desc.h264enc.num_temporal_layers)
+ if (context->desc.h264enc.num_temporal_layers > 0 &&
+ temporal_id >= context->desc.h264enc.num_temporal_layers)
return VA_STATUS_ERROR_INVALID_PARAMETER;
context->desc.h264enc.rate_ctrl[temporal_id].peak_bitrate = rc->bits_per_second;