mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-05 23:18:47 +00:00
vkencoder-private: fix parameters overrides
First remove validations since they will fail if there isn't a write operation. It's valid to pass data without write operations. Finally, it should check for hasOverride in feedback info. Nonetheless, there's a NVIDIA bug returning always FALSE for hasOverride, that's why we currently force it to TRUE. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/7993>
This commit is contained in:
parent
c024c5e3bf
commit
984956a6fe
1 changed files with 7 additions and 6 deletions
|
@ -844,6 +844,7 @@ gst_vulkan_encoder_video_session_parameters_overrides (GstVulkanEncoder * self,
|
||||||
GstVulkanEncoderPrivate *priv;
|
GstVulkanEncoderPrivate *priv;
|
||||||
gsize size;
|
gsize size;
|
||||||
gpointer param_data;
|
gpointer param_data;
|
||||||
|
gboolean write;
|
||||||
|
|
||||||
g_return_val_if_fail (GST_IS_VULKAN_ENCODER (self), FALSE);
|
g_return_val_if_fail (GST_IS_VULKAN_ENCODER (self), FALSE);
|
||||||
g_return_val_if_fail (params != NULL && feedback != NULL, FALSE);
|
g_return_val_if_fail (params != NULL && feedback != NULL, FALSE);
|
||||||
|
@ -854,29 +855,27 @@ gst_vulkan_encoder_video_session_parameters_overrides (GstVulkanEncoder * self,
|
||||||
|
|
||||||
switch (self->codec) {
|
switch (self->codec) {
|
||||||
case VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR:
|
case VK_VIDEO_CODEC_OPERATION_ENCODE_H264_BIT_KHR:
|
||||||
g_return_val_if_fail ((params->h264.writeStdPPS
|
|
||||||
|| params->h264.writeStdSPS) && data, FALSE);
|
|
||||||
if (params->h264.sType !=
|
if (params->h264.sType !=
|
||||||
VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_GET_INFO_KHR) {
|
VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_GET_INFO_KHR) {
|
||||||
gst_vulkan_error_to_g_error (GST_VULKAN_ERROR, error,
|
gst_vulkan_error_to_g_error (GST_VULKAN_ERROR, error,
|
||||||
"Invalid parameter for H.264");
|
"Invalid parameter for H.264");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
write = params->h264.writeStdPPS || params->h264.writeStdSPS;
|
||||||
if (feedback) {
|
if (feedback) {
|
||||||
feedback->h264.sType =
|
feedback->h264.sType =
|
||||||
VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_FEEDBACK_INFO_KHR;
|
VK_STRUCTURE_TYPE_VIDEO_ENCODE_H264_SESSION_PARAMETERS_FEEDBACK_INFO_KHR;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR:
|
case VK_VIDEO_CODEC_OPERATION_ENCODE_H265_BIT_KHR:
|
||||||
g_return_val_if_fail ((params->h265.writeStdPPS
|
|
||||||
|| params->h265.writeStdSPS || params->h265.writeStdVPS)
|
|
||||||
&& data, FALSE);
|
|
||||||
if (params->h265.sType !=
|
if (params->h265.sType !=
|
||||||
VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_GET_INFO_KHR) {
|
VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_GET_INFO_KHR) {
|
||||||
gst_vulkan_error_to_g_error (GST_VULKAN_ERROR, error,
|
gst_vulkan_error_to_g_error (GST_VULKAN_ERROR, error,
|
||||||
"Invalid parameter for H.265");
|
"Invalid parameter for H.265");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
write = params->h265.writeStdPPS || params->h265.writeStdSPS
|
||||||
|
|| params->h265.writeStdVPS;
|
||||||
if (feedback) {
|
if (feedback) {
|
||||||
feedback->h265.sType =
|
feedback->h265.sType =
|
||||||
VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_FEEDBACK_INFO_KHR;
|
VK_STRUCTURE_TYPE_VIDEO_ENCODE_H265_SESSION_PARAMETERS_FEEDBACK_INFO_KHR;
|
||||||
|
@ -905,7 +904,9 @@ gst_vulkan_encoder_video_session_parameters_overrides (GstVulkanEncoder * self,
|
||||||
"vGetEncodedVideoSessionParametersKHR") != VK_SUCCESS)
|
"vGetEncodedVideoSessionParametersKHR") != VK_SUCCESS)
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (!data)
|
/* FIXME: forcing because a bug in NVIDIA driver */
|
||||||
|
feedback_info.hasOverrides = 1;
|
||||||
|
if (!feedback_info.hasOverrides || !data || !write)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "allocating for bitstream parameters %"
|
GST_DEBUG_OBJECT (self, "allocating for bitstream parameters %"
|
||||||
|
|
Loading…
Reference in a new issue