Commit b24752da authored by Gwenole Beauchesne's avatar Gwenole Beauchesne

decoder: simplify gst_vaapi_decoder_get_surface().

Avoid extraenous branches, i.e. immediately return with success once we
have a decoded frame available.
parent a811a5de
......@@ -659,21 +659,15 @@ gst_vaapi_decoder_get_surface(GstVaapiDecoder *decoder,
do {
frame = pop_frame(decoder);
if (frame)
break;
if (frame) {
*out_proxy_ptr = gst_vaapi_surface_proxy_ref(frame->user_data);
gst_video_codec_frame_unref(frame);
return GST_VAAPI_DECODER_STATUS_SUCCESS;
}
status = decode_step(decoder);
} while (status == GST_VAAPI_DECODER_STATUS_SUCCESS);
if (frame) {
*out_proxy_ptr = gst_vaapi_surface_proxy_ref(frame->user_data);
gst_video_codec_frame_unref(frame);
status = GST_VAAPI_DECODER_STATUS_SUCCESS;
}
else {
*out_proxy_ptr = NULL;
if (status == GST_VAAPI_DECODER_STATUS_SUCCESS)
status = GST_VAAPI_DECODER_STATUS_ERROR_NO_DATA;
}
*out_proxy_ptr = NULL;
return status;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment