...
 
Commits (12)
include: "https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/master/gitlab/ci_template.yml"
include: "https://gitlab.freedesktop.org/gstreamer/gst-ci/raw/1.16/gitlab/ci_template.yml"
......@@ -118,8 +118,7 @@ gst_vaapi_decoder_vp9_close (GstVaapiDecoderVp9 * decoder)
for (i = 0; i < GST_VP9_REF_FRAMES; i++)
gst_vaapi_picture_replace (&priv->ref_frames[i], NULL);
if (priv->parser)
gst_vp9_parser_free (priv->parser);
g_clear_pointer (&priv->parser, gst_vp9_parser_free);
}
static gboolean
......@@ -220,7 +219,16 @@ ensure_context (GstVaapiDecoderVp9 * decoder)
info.profile = priv->profile;
info.entrypoint = entrypoint;
info.chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420;
if (priv->parser->bit_depth == GST_VP9_BIT_DEPTH_8) {
info.chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420;
} else if (priv->parser->bit_depth == GST_VP9_BIT_DEPTH_10) {
info.chroma_type = GST_VAAPI_CHROMA_TYPE_YUV420_10BPP;
} else {
GST_WARNING ("VP9 with depth %d, bigger than 10BPP not supported now",
priv->parser->bit_depth);
return GST_VAAPI_DECODER_STATUS_ERROR_UNSUPPORTED_CHROMA_FORMAT;
}
info.width = priv->width;
info.height = priv->height;
info.ref_frames = 8;
......
......@@ -329,6 +329,8 @@ gst_vaapi_encoder_ensure_param_roi_regions (GstVaapiEncoder * encoder,
roi = (GstVideoRegionOfInterestMeta *)
gst_buffer_iterate_meta_filtered (input, &state,
GST_VIDEO_REGION_OF_INTEREST_META_API_TYPE);
if (!roi)
continue;
/* ignore roi if overflow */
if ((roi->x > G_MAXINT16) || (roi->y > G_MAXINT16)
......
......@@ -2745,6 +2745,7 @@ reset_properties (GstVaapiEncoderH264 * encoder)
{
GstVaapiEncoder *const base_encoder = GST_VAAPI_ENCODER_CAST (encoder);
guint mb_size, i;
gboolean ret;
if (encoder->idr_period < base_encoder->keyframe_period)
encoder->idr_period = base_encoder->keyframe_period;
......@@ -2754,8 +2755,9 @@ reset_properties (GstVaapiEncoderH264 * encoder)
encoder->qp_i = encoder->init_qp;
mb_size = encoder->mb_width * encoder->mb_height;
g_assert (gst_vaapi_encoder_ensure_num_slices (base_encoder, encoder->profile,
encoder->entrypoint, (mb_size + 1) / 2, &encoder->num_slices));
ret = gst_vaapi_encoder_ensure_num_slices (base_encoder, encoder->profile,
encoder->entrypoint, (mb_size + 1) / 2, &encoder->num_slices);
g_assert (ret);
if (encoder->num_bframes > (base_encoder->keyframe_period + 1) / 2)
encoder->num_bframes = (base_encoder->keyframe_period + 1) / 2;
......
......@@ -1721,6 +1721,9 @@ add_slice_headers (GstVaapiEncoderH265 * encoder, GstVaapiEncPicture * picture,
slice_param->num_ref_idx_l1_active_minus1 = reflist_1_count - 1;
else
slice_param->num_ref_idx_l1_active_minus1 = 0;
if (picture->type == GST_VAAPI_PICTURE_TYPE_P && encoder->low_delay_b)
slice_param->num_ref_idx_l1_active_minus1 =
slice_param->num_ref_idx_l0_active_minus1;
i_ref = 0;
if (picture->type != GST_VAAPI_PICTURE_TYPE_I) {
......@@ -2058,6 +2061,7 @@ reset_properties (GstVaapiEncoderH265 * encoder)
GstVaapiH265ReorderPool *reorder_pool;
GstVaapiH265RefPool *ref_pool;
guint ctu_size;
gboolean ret;
if (encoder->idr_period < base_encoder->keyframe_period)
encoder->idr_period = base_encoder->keyframe_period;
......@@ -2067,8 +2071,9 @@ reset_properties (GstVaapiEncoderH265 * encoder)
encoder->qp_i = encoder->init_qp;
ctu_size = encoder->ctu_width * encoder->ctu_height;
g_assert (gst_vaapi_encoder_ensure_num_slices (base_encoder, encoder->profile,
encoder->entrypoint, (ctu_size + 1) / 2, &encoder->num_slices));
ret = gst_vaapi_encoder_ensure_num_slices (base_encoder, encoder->profile,
encoder->entrypoint, (ctu_size + 1) / 2, &encoder->num_slices);
g_assert (ret);
gst_vaapi_encoder_ensure_max_num_ref_frames (base_encoder, encoder->profile,
encoder->entrypoint);
......
......@@ -417,8 +417,10 @@ ensure_sequence (GstVaapiEncoderMpeg2 * encoder, GstVaapiEncPicture * picture)
if (!fill_sequence (encoder, sequence))
goto error;
if (picture->type == GST_VAAPI_PICTURE_TYPE_I &&
!set_sequence_packed_header (encoder, picture, sequence))
if ((GST_VAAPI_ENCODER_PACKED_HEADERS (encoder) &
VA_ENC_PACKED_HEADER_SEQUENCE)
&& picture->type == GST_VAAPI_PICTURE_TYPE_I
&& !set_sequence_packed_header (encoder, picture, sequence))
goto error;
gst_vaapi_enc_picture_set_sequence (picture, sequence);
gst_vaapi_codec_object_replace (&sequence, NULL);
......@@ -442,7 +444,9 @@ ensure_picture (GstVaapiEncoderMpeg2 * encoder, GstVaapiEncPicture * picture,
if (!fill_picture (encoder, picture, codedbuf, surface))
return FALSE;
if (!set_picture_packed_header (encoder, picture)) {
if ((GST_VAAPI_ENCODER_PACKED_HEADERS (encoder) &
VA_ENC_PACKED_HEADER_PICTURE)
&& !set_picture_packed_header (encoder, picture)) {
GST_ERROR ("set picture packed header failed");
return FALSE;
}
......
......@@ -445,6 +445,11 @@ error:
static GstVaapiEncoderStatus
gst_vaapi_encoder_vp8_flush (GstVaapiEncoder * base_encoder)
{
GstVaapiEncoderVP8 *const encoder = GST_VAAPI_ENCODER_VP8 (base_encoder);
encoder->frame_num = 0;
clear_references (encoder);
return GST_VAAPI_ENCODER_STATUS_SUCCESS;
}
......
......@@ -462,6 +462,10 @@ error:
static GstVaapiEncoderStatus
gst_vaapi_encoder_vp9_flush (GstVaapiEncoder * base_encoder)
{
GstVaapiEncoderVP9 *const encoder = GST_VAAPI_ENCODER_VP9 (base_encoder);
encoder->frame_num = 0;
return GST_VAAPI_ENCODER_STATUS_SUCCESS;
}
......
......@@ -36,6 +36,7 @@ gst_vaapi_surface_get_drm_buf_handle (GstVaapiSurface * surface, guint type)
if (!image)
goto error_derive_image;
/* The proxy takes ownership if the image, even creation failure. */
proxy =
gst_vaapi_buffer_proxy_new_from_object (GST_VAAPI_OBJECT (surface),
image->internal_image.buf, type, gst_vaapi_object_unref, image);
......@@ -52,7 +53,6 @@ error_derive_image:
error_alloc_export_buffer:
{
GST_ERROR ("failed to allocate export buffer proxy");
gst_vaapi_object_unref (image);
return NULL;
}
}
......
......@@ -769,6 +769,9 @@ gst_vaapiencode_change_state (GstElement * element, GstStateChange transition)
switch (transition) {
case GST_STATE_CHANGE_PAUSED_TO_READY:
gst_pad_stop_task (GST_VAAPI_PLUGIN_BASE_SRC_PAD (encode));
if (!gst_vaapiencode_drain (encode))
goto drain_error;
break;
default:
break;
......@@ -776,6 +779,12 @@ gst_vaapiencode_change_state (GstElement * element, GstStateChange transition)
return
GST_ELEMENT_CLASS (gst_vaapiencode_parent_class)->change_state (element,
transition);
drain_error:
{
GST_ERROR ("failed to drain pending encoded frames");
return GST_STATE_CHANGE_FAILURE;
}
}
static gboolean
......
......@@ -709,9 +709,11 @@ _get_preferred_caps (GstVaapiPostproc * postproc, GstVideoInfo * vinfo,
/* we don't need to do format conversion if GL_TEXTURE_UPLOAD_META
* is negotiated */
if (f != GST_VAAPI_CAPS_FEATURE_GL_TEXTURE_UPLOAD_META
&& postproc->format != format)
if (f == GST_VAAPI_CAPS_FEATURE_GL_TEXTURE_UPLOAD_META) {
postproc->format = DEFAULT_FORMAT;
} else if (postproc->format != format) {
postproc->format = format;
}
return outcaps;
......
......@@ -709,7 +709,7 @@ bail:
/* ERRORS */
error_no_derive_image:
{
GST_ERROR ("Cannot create a VA derived image from surface %p", surface);
GST_INFO ("Cannot create a VA derived image from surface %p", surface);
return FALSE;
}
error_cannot_map:
......