rtph264pay: add "send SPS/PPS with every key frame" mode

It's not enough to have timeout or event based SPS/PPS information sent
in RTP packets. There are some scenarios when key frames may appear
more frequently than once a second, in which case the minimum timeout
for "config-interval" of 1 second for sending SPS/PPS is not sufficient.
It might also be desirable in general to make sure the SPS/PPS is
available with every keyframe (packet loss aside), so receivers can
actually pick up decoding immediately from the first keyframe if
SPS/PPS is not signaled out of band.

This patch adds the possibility to send SPS/PPS with every key frame. This
mode can be enabled by setting "config-interval" property to -1. In this
case the payloader will add SPS and PPS before every key (IDR) frame.

https://bugzilla.gnome.org/show_bug.cgi?id=757892
This commit is contained in:
Anton Bondarenko 2015-11-27 09:27:29 +01:00 committed by Tim-Philipp Müller
parent 3026d1094b
commit 453a618a9d

View file

@ -127,7 +127,8 @@ gst_rtp_h264_pay_class_init (GstRtpH264PayClass * klass)
g_param_spec_int ("config-interval",
"SPS PPS Send Interval",
"Send SPS and PPS Insertion Interval in seconds (sprop parameter sets "
"will be multiplexed in the data stream when detected.) (0 = disabled)",
"will be multiplexed in the data stream when detected.) "
"(0 = disabled, -1 = send with every IDR frame)",
-1, 3600, DEFAULT_CONFIG_INTERVAL,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS)
);
@ -829,6 +830,10 @@ gst_rtp_h264_pay_payload_nal (GstRTPBasePayload * basepayload,
GST_DEBUG_OBJECT (rtph264pay, "no previous SPS/PPS time, send now");
send_spspps = TRUE;
}
} else if (nalType == IDR_TYPE_ID && rtph264pay->spspps_interval == -1) {
GST_DEBUG_OBJECT (rtph264pay, "sending SPS/PPS before current IDR frame");
/* send SPS/PPS before every IDR frame */
send_spspps = TRUE;
}
if (send_spspps || rtph264pay->send_spspps) {