summaryrefslogtreecommitdiff
path: root/subprojects
diff options
context:
space:
mode:
authorCamilo Celis Guzman <camilo@pexip.com>2023-05-02 21:45:48 +0900
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2023-05-05 07:45:19 +0000
commit11187a81c3ca732a52792ce86afa2a634a704658 (patch)
treec5b725d2f9321b373ee6b7b4cfda5d1600dc141a /subprojects
parent7cffb40c2e0cb91e4aa29423e2e2c0bff0727188 (diff)
downloadgstreamer-11187a81c3ca732a52792ce86afa2a634a704658.tar.gz
rtpvp9pay: add picture-id-offset property
Bring the VP9 payloader in sync in this regard to the VP8 payloader Allowing setting the picture id to a known value is useful when testing. Part-of: <https://gitlab.freedesktop.org/gstreamer/gstreamer/-/merge_requests/4530>
Diffstat (limited to 'subprojects')
-rw-r--r--subprojects/gst-plugins-good/docs/gst_plugins_cache.json14
-rw-r--r--subprojects/gst-plugins-good/gst/rtp/gstrtpvp9pay.c35
-rw-r--r--subprojects/gst-plugins-good/gst/rtp/gstrtpvp9pay.h1
3 files changed, 48 insertions, 2 deletions
diff --git a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json
index b5ba9e23ac..c1249c438d 100644
--- a/subprojects/gst-plugins-good/docs/gst_plugins_cache.json
+++ b/subprojects/gst-plugins-good/docs/gst_plugins_cache.json
@@ -17031,6 +17031,20 @@
"readable": true,
"type": "GstVP9RTPPayMode",
"writable": true
+ },
+ "picture-id-offset": {
+ "blurb": "Offset to add to the initial picture-id (-1 = random)",
+ "conditionally-available": false,
+ "construct": false,
+ "construct-only": false,
+ "controllable": false,
+ "default": "-1",
+ "max": "32767",
+ "min": "-1",
+ "mutable": "null",
+ "readable": true,
+ "type": "gint",
+ "writable": true
}
},
"rank": "marginal"
diff --git a/subprojects/gst-plugins-good/gst/rtp/gstrtpvp9pay.c b/subprojects/gst-plugins-good/gst/rtp/gstrtpvp9pay.c
index ecb0973ace..87b2c5834a 100644
--- a/subprojects/gst-plugins-good/gst/rtp/gstrtpvp9pay.c
+++ b/subprojects/gst-plugins-good/gst/rtp/gstrtpvp9pay.c
@@ -41,11 +41,13 @@ GST_DEBUG_CATEGORY_STATIC (gst_rtp_vp9_pay_debug);
#define GST_CAT_DEFAULT gst_rtp_vp9_pay_debug
#define DEFAULT_PICTURE_ID_MODE VP9_PAY_NO_PICTURE_ID
+#define DEFAULT_PICTURE_ID_OFFSET (-1)
enum
{
PROP_0,
- PROP_PICTURE_ID_MODE
+ PROP_PICTURE_ID_MODE,
+ PROP_PICTURE_ID_OFFSET,
};
#define GST_TYPE_RTP_VP9_PAY_PICTURE_ID_MODE (gst_rtp_vp9_pay_picture_id_mode_get_type())
@@ -110,20 +112,29 @@ static void
gst_rtp_vp9_pay_picture_id_reset (GstRtpVP9Pay * self)
{
gint nbits;
+ guint16 old_picture_id = self->picture_id;
if (self->picture_id_mode == VP9_PAY_NO_PICTURE_ID) {
self->picture_id = 0;
} else {
- self->picture_id = g_random_int ();
+ if (self->picture_id_offset == DEFAULT_PICTURE_ID_OFFSET) {
+ self->picture_id = g_random_int ();
+ } else {
+ self->picture_id = self->picture_id_offset;
+ }
nbits = picture_id_field_len (self->picture_id_mode);
self->picture_id &= (1 << nbits) - 1;
}
+
+ GST_LOG_OBJECT (self, "picture-id reset %u -> %u",
+ old_picture_id, self->picture_id);
}
static void
gst_rtp_vp9_pay_init (GstRtpVP9Pay * obj)
{
obj->picture_id_mode = DEFAULT_PICTURE_ID_MODE;
+ obj->picture_id_offset = DEFAULT_PICTURE_ID_OFFSET;
gst_rtp_vp9_pay_picture_id_reset (obj);
}
@@ -144,6 +155,19 @@ gst_rtp_vp9_pay_class_init (GstRtpVP9PayClass * gst_rtp_vp9_pay_class)
GST_TYPE_RTP_VP9_PAY_PICTURE_ID_MODE, DEFAULT_PICTURE_ID_MODE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+ /**
+ * rtpvp9pay:picture-id-offset:
+ *
+ * Offset to add to the initial picture-id (-1 = random)
+ *
+ * Since: 1.24
+ */
+ g_object_class_install_property (gobject_class, PROP_PICTURE_ID_OFFSET,
+ g_param_spec_int ("picture-id-offset", "Picture ID offset",
+ "Offset to add to the initial picture-id (-1 = random)",
+ -1, 0x7FFF, DEFAULT_PICTURE_ID_OFFSET,
+ G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
+
gst_element_class_add_static_pad_template (element_class,
&gst_rtp_vp9_pay_sink_template);
gst_element_class_add_static_pad_template (element_class,
@@ -174,6 +198,10 @@ gst_rtp_vp9_pay_set_property (GObject * object,
rtpvp9pay->picture_id_mode = g_value_get_enum (value);
gst_rtp_vp9_pay_picture_id_reset (rtpvp9pay);
break;
+ case PROP_PICTURE_ID_OFFSET:
+ rtpvp9pay->picture_id_offset = g_value_get_int (value);
+ gst_rtp_vp9_pay_picture_id_reset (rtpvp9pay);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@@ -190,6 +218,9 @@ gst_rtp_vp9_pay_get_property (GObject * object,
case PROP_PICTURE_ID_MODE:
g_value_set_enum (value, rtpvp9pay->picture_id_mode);
break;
+ case PROP_PICTURE_ID_OFFSET:
+ g_value_set_int (value, rtpvp9pay->picture_id_offset);
+ break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
diff --git a/subprojects/gst-plugins-good/gst/rtp/gstrtpvp9pay.h b/subprojects/gst-plugins-good/gst/rtp/gstrtpvp9pay.h
index 525d4988cb..b9d966d08b 100644
--- a/subprojects/gst-plugins-good/gst/rtp/gstrtpvp9pay.h
+++ b/subprojects/gst-plugins-good/gst/rtp/gstrtpvp9pay.h
@@ -60,6 +60,7 @@ struct _GstRtpVP9Pay
guint width;
guint height;
GstVP9RtpPayPictureIDMode picture_id_mode;
+ gint picture_id_offset;
guint16 picture_id;
};