libs: encoder: h264: submit sps in case of IDR picture
authorHyunjun Ko <zzoon@igalia.com>
Fri, 9 Jun 2017 05:47:40 +0000 (14:47 +0900)
committerVíctor Manuel Jáquez Leal <vjaquez@igalia.com>
Tue, 4 Jul 2017 12:25:39 +0000 (14:25 +0200)
If the picture is IDR, also submit a SPS header.

This means when frame number reaches to keyframe-period or an force
key unit event arrives, we insert SPS/PPS again.

https://bugzilla.gnome.org/show_bug.cgi?id=776712

gst-libs/gst/vaapi/gstvaapiencoder_h264.c

index 3ae4430..601a4be 100644 (file)
@@ -2175,8 +2175,11 @@ ensure_sequence (GstVaapiEncoderH264 * encoder, GstVaapiEncPicture * picture)
       goto error_create_packed_au_delimiter;
   }
 
-  /* submit an SPS header before every new I-frame, if codec config changed */
-  if (!encoder->config_changed || picture->type != GST_VAAPI_PICTURE_TYPE_I)
+  /* submit an SPS header before every new I-frame, if codec config changed
+   * or if the picture is IDR.
+   */
+  if ((!encoder->config_changed || picture->type != GST_VAAPI_PICTURE_TYPE_I)
+      && !GST_VAAPI_ENC_PICTURE_IS_IDR (picture))
     return TRUE;
 
   sequence = GST_VAAPI_ENC_SEQUENCE_NEW (H264, encoder);