From: Sreerenj Balachandran Date: Fri, 27 Jun 2014 13:38:03 +0000 (+0300) Subject: encoder: h264: generate new SPS only when codec config changed. X-Git-Tag: 0.5.9~58 X-Git-Url: http://review.tizen.org/git/?p=platform%2Fupstream%2Fgstreamer-vaapi.git;a=commitdiff_plain;h=95d7f95971467bc7af75f8be4b68d5d7c8df4f99 encoder: h264: generate new SPS only when codec config changed. It is not necessary to periodically send SPS or subset SPS headers. This is up to the upper layer (e.g. transport layer) to decide on if/how to periodically submit those. For now, only generate new SPS or subset SPS headers when the codec config changed. Note: the upper layer could readily determine the config headers (SPS/PPS) through the gst_vaapi_encoder_h264_get_codec_data() function. https://bugzilla.gnome.org/show_bug.cgi?id=732083 Signed-off-by: Gwenole Beauchesne --- diff --git a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c index c955d95..3277f00 100644 --- a/gst-libs/gst/vaapi/gstvaapiencoder_h264.c +++ b/gst-libs/gst/vaapi/gstvaapiencoder_h264.c @@ -1941,8 +1941,8 @@ ensure_sequence (GstVaapiEncoderH264 * encoder, GstVaapiEncPicture * picture) { GstVaapiEncSequence *sequence = NULL; - // Submit an SPS header before every new I-frame - if (picture->type != GST_VAAPI_PICTURE_TYPE_I) + /* submit an SPS header before every new I-frame, if codec config changed */ + if (!encoder->config_changed || picture->type != GST_VAAPI_PICTURE_TYPE_I) return TRUE; sequence = GST_VAAPI_ENC_SEQUENCE_NEW (H264, encoder); @@ -1964,6 +1964,9 @@ ensure_sequence (GstVaapiEncoderH264 * encoder, GstVaapiEncPicture * picture) gst_vaapi_enc_picture_set_sequence (picture, sequence); gst_vaapi_codec_object_replace (&sequence, NULL); } + + if (!encoder->is_mvc || encoder->view_idx > 0) + encoder->config_changed = FALSE; return TRUE; /* ERRORS */