mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 20:21:24 +00:00
decoder: vp9: Add repeat-frame display handling
If vp9 frame header come up with show_existing_frame flag set, we should duplicate the existing decoded frame as current frame to be displayed.
This commit is contained in:
parent
ac8d19dab4
commit
247896884b
1 changed files with 30 additions and 8 deletions
|
@ -399,27 +399,49 @@ decode_picture (GstVaapiDecoderVp9 * decoder, const guchar * buf,
|
||||||
GstVaapiPicture *picture;
|
GstVaapiPicture *picture;
|
||||||
GstVaapiDecoderStatus status;
|
GstVaapiDecoderStatus status;
|
||||||
guint crop_width = 0, crop_height = 0;
|
guint crop_width = 0, crop_height = 0;
|
||||||
|
gboolean is_clone_pic = FALSE;
|
||||||
|
|
||||||
status = ensure_context (decoder);
|
status = ensure_context (decoder);
|
||||||
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
|
||||||
return status;
|
return status;
|
||||||
|
|
||||||
/* Fixme: handle show_existing_frame */
|
/* if show_exising_frame flag is true, we just need to return
|
||||||
|
* the existing frame in ref frame array, so creating a clone
|
||||||
|
* of already decoded frame */
|
||||||
|
if (frame_hdr->show_existing_frame) {
|
||||||
|
GstVaapiPicture *existing_frame =
|
||||||
|
priv->ref_frames[frame_hdr->frame_to_show];
|
||||||
|
|
||||||
/* Create new picture */
|
if (!existing_frame) {
|
||||||
picture = GST_VAAPI_PICTURE_NEW (VP9, decoder);
|
GST_ERROR ("Failed to get the existing frame from dpb");
|
||||||
if (!picture) {
|
return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
|
||||||
GST_ERROR ("failed to allocate picture");
|
}
|
||||||
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
|
|
||||||
|
picture = gst_vaapi_picture_new_clone (existing_frame);
|
||||||
|
if (!picture) {
|
||||||
|
GST_ERROR ("Failed to create clone picture");
|
||||||
|
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
|
||||||
|
}
|
||||||
|
|
||||||
|
is_clone_pic = TRUE;
|
||||||
|
} else {
|
||||||
|
/* Create new picture */
|
||||||
|
picture = GST_VAAPI_PICTURE_NEW (VP9, decoder);
|
||||||
|
if (!picture) {
|
||||||
|
GST_ERROR ("failed to allocate picture");
|
||||||
|
return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
gst_vaapi_picture_replace (&priv->current_picture, picture);
|
gst_vaapi_picture_replace (&priv->current_picture, picture);
|
||||||
gst_vaapi_picture_unref (picture);
|
gst_vaapi_picture_unref (picture);
|
||||||
|
|
||||||
|
if (is_clone_pic)
|
||||||
|
return GST_VAAPI_DECODER_STATUS_SUCCESS;
|
||||||
|
|
||||||
if (frame_hdr->display_size_enabled) {
|
if (frame_hdr->display_size_enabled) {
|
||||||
crop_width = frame_hdr->display_width;
|
crop_width = frame_hdr->display_width;
|
||||||
crop_height = frame_hdr->display_height;
|
crop_height = frame_hdr->display_height;
|
||||||
} else if (priv->width > frame_hdr->width
|
} else if (priv->width > frame_hdr->width || priv->height > frame_hdr->height) {
|
||||||
|| priv->height > frame_hdr->height) {
|
|
||||||
crop_width = frame_hdr->width;
|
crop_width = frame_hdr->width;
|
||||||
crop_height = frame_hdr->height;
|
crop_height = frame_hdr->height;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue