msdkenc: renegotiate when video info changes

Renegotiation was implemented for bitrate change. We can re-use
the same sequence when video info changes except that this can be
executed right away when receiving the new input format. I.e. no
need to wait for the next call to handle_frame.
This commit is contained in:
Julien Isorce 2019-12-26 13:31:50 -08:00 committed by Julien Isorce
parent 9f1fbd3649
commit f578eab6fd

View file

@ -1097,8 +1097,14 @@ gst_msdkenc_set_format (GstVideoEncoder * encoder, GstVideoCodecState * state)
GstMsdkEncClass *klass = GST_MSDKENC_GET_CLASS (thiz);
if (state) {
if (thiz->input_state)
if (thiz->input_state) {
if (!gst_video_info_is_equal (&thiz->input_state->info, &state->info)) {
GST_INFO_OBJECT (thiz, "Re-init the encoder as info changed");
gst_msdkenc_flush_frames (thiz, FALSE);
gst_msdkenc_close_encoder (thiz);
}
gst_video_codec_state_unref (thiz->input_state);
}
thiz->input_state = gst_video_codec_state_ref (state);
}