From: Alessandro Decina Date: Thu, 2 Jun 2016 01:36:57 +0000 (+1000) Subject: vtdec: optimize renegotiation X-Git-Tag: 1.10.4~648 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=bf444301f998b5aff1fd7e7d18cf7edc2a42b68b;p=platform%2Fupstream%2Fgst-plugins-bad.git vtdec: optimize renegotiation ::negotiate can be called several times before the CAPS event is sent downstream so use the currently configured output state caps instead of the pad current caps when deciding whether to recreate the VTSession or not. This leads to creating/destroying less VTSessions which makes renegotiation more reliable especially when using hw decoding. --- diff --git a/sys/applemedia/vtdec.c b/sys/applemedia/vtdec.c index cf736b2..7f96bd9 100644 --- a/sys/applemedia/vtdec.c +++ b/sys/applemedia/vtdec.c @@ -245,6 +245,12 @@ gst_vtdec_negotiate (GstVideoDecoder * decoder) if (features) features = gst_caps_features_copy (features); + output_state = gst_video_decoder_get_output_state (GST_VIDEO_DECODER (vtdec)); + if (output_state) { + prevcaps = gst_caps_ref (output_state->caps); + gst_video_codec_state_unref (output_state); + } + output_state = gst_video_decoder_set_output_state (GST_VIDEO_DECODER (vtdec), format, vtdec->video_info.width, vtdec->video_info.height, vtdec->input_state); @@ -265,10 +271,10 @@ gst_vtdec_negotiate (GstVideoDecoder * decoder) } gst_caps_unref (caps); - prevcaps = gst_pad_get_current_caps (decoder->srcpad); if (!prevcaps || !gst_caps_is_equal (prevcaps, output_state->caps)) { - GST_INFO_OBJECT (vtdec, "negotiated output format %" GST_PTR_FORMAT, - output_state->caps); + GST_INFO_OBJECT (vtdec, + "negotiated output format %" GST_PTR_FORMAT " previous %" + GST_PTR_FORMAT, output_state->caps, prevcaps); if (vtdec->session) { gst_vtdec_push_frames_if_needed (vtdec, TRUE, FALSE);