vtdec: always drain in ::negotiate

Move calling gst_vtdec_push_frames_if_needed from ::set_format to ::negotiate so
that we always drain even when renegotiation is triggered by downstream.
This commit is contained in:
Alessandro Decina 2016-06-07 17:22:01 +10:00
parent 7fea17a476
commit a037f13271

View file

@ -230,6 +230,8 @@ gst_vtdec_negotiate (GstVideoDecoder * decoder)
gboolean output_textures; gboolean output_textures;
vtdec = GST_VTDEC (decoder); vtdec = GST_VTDEC (decoder);
if (vtdec->session)
gst_vtdec_push_frames_if_needed (vtdec, TRUE, FALSE);
templcaps = templcaps =
gst_pad_get_pad_template_caps (GST_VIDEO_DECODER_SRC_PAD (decoder)); gst_pad_get_pad_template_caps (GST_VIDEO_DECODER_SRC_PAD (decoder));
peercaps = gst_pad_peer_query_caps (GST_VIDEO_DECODER_SRC_PAD (vtdec), NULL); peercaps = gst_pad_peer_query_caps (GST_VIDEO_DECODER_SRC_PAD (vtdec), NULL);
@ -279,10 +281,8 @@ gst_vtdec_negotiate (GstVideoDecoder * decoder)
"negotiated output format %" GST_PTR_FORMAT " previous %" "negotiated output format %" GST_PTR_FORMAT " previous %"
GST_PTR_FORMAT, output_state->caps, prevcaps); GST_PTR_FORMAT, output_state->caps, prevcaps);
if (vtdec->session) { if (vtdec->session)
gst_vtdec_push_frames_if_needed (vtdec, TRUE, FALSE);
gst_vtdec_invalidate_session (vtdec); gst_vtdec_invalidate_session (vtdec);
}
err = gst_vtdec_create_session (vtdec, format, TRUE); err = gst_vtdec_create_session (vtdec, format, TRUE);
if (err == noErr) { if (err == noErr) {
@ -357,9 +357,6 @@ gst_vtdec_set_format (GstVideoDecoder * decoder, GstVideoCodecState * state)
return TRUE; return TRUE;
} }
if (vtdec->session)
gst_vtdec_push_frames_if_needed (vtdec, TRUE, FALSE);
gst_video_info_from_caps (&vtdec->video_info, state->caps); gst_video_info_from_caps (&vtdec->video_info, state->caps);
if (!gst_vtdec_compute_reorder_queue_length (vtdec, cm_format, if (!gst_vtdec_compute_reorder_queue_length (vtdec, cm_format,