summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSreerenj Balachandran <sreerenj.balachandran@intel.com>2015-11-16 18:21:56 +0200
committerSreerenj Balachandran <sreerenj.balachandran@intel.com>2015-11-16 18:21:56 +0200
commit247896884b0d8dc4af4ab3290bac69b9a4e2784d (patch)
tree21b1dd46171cf5ec61b1866dd9f5f9b207fa8d5b
parentac8d19dab48a397ac51985b8bdc589f62e6a15ab (diff)
downloadgst-vaapi-247896884b0d8dc4af4ab3290bac69b9a4e2784d.tar.gz
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.
-rw-r--r--gst-libs/gst/vaapi/gstvaapidecoder_vp9.c38
1 files changed, 30 insertions, 8 deletions
diff --git a/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c b/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c
index ea5673a0..5309c490 100644
--- a/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c
+++ b/gst-libs/gst/vaapi/gstvaapidecoder_vp9.c
@@ -399,27 +399,49 @@ decode_picture (GstVaapiDecoderVp9 * decoder, const guchar * buf,
GstVaapiPicture *picture;
GstVaapiDecoderStatus status;
guint crop_width = 0, crop_height = 0;
+ gboolean is_clone_pic = FALSE;
status = ensure_context (decoder);
if (status != GST_VAAPI_DECODER_STATUS_SUCCESS)
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 */
- picture = GST_VAAPI_PICTURE_NEW (VP9, decoder);
- if (!picture) {
- GST_ERROR ("failed to allocate picture");
- return GST_VAAPI_DECODER_STATUS_ERROR_ALLOCATION_FAILED;
+ if (!existing_frame) {
+ GST_ERROR ("Failed to get the existing frame from dpb");
+ return GST_VAAPI_DECODER_STATUS_ERROR_UNKNOWN;
+ }
+
+ 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_unref (picture);
+ if (is_clone_pic)
+ return GST_VAAPI_DECODER_STATUS_SUCCESS;
+
if (frame_hdr->display_size_enabled) {
crop_width = frame_hdr->display_width;
crop_height = frame_hdr->display_height;
- } else if (priv->width > frame_hdr->width
- || priv->height > frame_hdr->height) {
+ } else if (priv->width > frame_hdr->width || priv->height > frame_hdr->height) {
crop_width = frame_hdr->width;
crop_height = frame_hdr->height;
}