diff options
author | Anton Bondarenko <antonbo@axis.com> | 2015-11-27 09:27:29 +0100 |
---|---|---|
committer | Tim-Philipp Müller <tim@centricular.com> | 2015-11-27 13:30:07 +0000 |
commit | 453a618a9dc0ee6b35532f8b6c1d526300e17c54 (patch) | |
tree | 12fe67df23ad5a6d367a84eafe0940f11a4fead1 | |
parent | 3026d1094b0041c9d43279cdb6a441391c6e6170 (diff) |
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
-rw-r--r-- | gst/rtp/gstrtph264pay.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/gst/rtp/gstrtph264pay.c b/gst/rtp/gstrtph264pay.c index af25e739f..c8100ec46 100644 --- a/gst/rtp/gstrtph264pay.c +++ b/gst/rtp/gstrtph264pay.c @@ -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) { |