mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-05 14:02:26 +00:00
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>
This commit is contained in:
parent
7cffb40c2e
commit
11187a81c3
3 changed files with 48 additions and 2 deletions
|
@ -17031,6 +17031,20 @@
|
||||||
"readable": true,
|
"readable": true,
|
||||||
"type": "GstVP9RTPPayMode",
|
"type": "GstVP9RTPPayMode",
|
||||||
"writable": true
|
"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"
|
"rank": "marginal"
|
||||||
|
|
|
@ -41,11 +41,13 @@ GST_DEBUG_CATEGORY_STATIC (gst_rtp_vp9_pay_debug);
|
||||||
#define GST_CAT_DEFAULT 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_MODE VP9_PAY_NO_PICTURE_ID
|
||||||
|
#define DEFAULT_PICTURE_ID_OFFSET (-1)
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PROP_0,
|
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())
|
#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)
|
gst_rtp_vp9_pay_picture_id_reset (GstRtpVP9Pay * self)
|
||||||
{
|
{
|
||||||
gint nbits;
|
gint nbits;
|
||||||
|
guint16 old_picture_id = self->picture_id;
|
||||||
|
|
||||||
if (self->picture_id_mode == VP9_PAY_NO_PICTURE_ID) {
|
if (self->picture_id_mode == VP9_PAY_NO_PICTURE_ID) {
|
||||||
self->picture_id = 0;
|
self->picture_id = 0;
|
||||||
} else {
|
} 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);
|
nbits = picture_id_field_len (self->picture_id_mode);
|
||||||
self->picture_id &= (1 << nbits) - 1;
|
self->picture_id &= (1 << nbits) - 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
GST_LOG_OBJECT (self, "picture-id reset %u -> %u",
|
||||||
|
old_picture_id, self->picture_id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_rtp_vp9_pay_init (GstRtpVP9Pay * obj)
|
gst_rtp_vp9_pay_init (GstRtpVP9Pay * obj)
|
||||||
{
|
{
|
||||||
obj->picture_id_mode = DEFAULT_PICTURE_ID_MODE;
|
obj->picture_id_mode = DEFAULT_PICTURE_ID_MODE;
|
||||||
|
obj->picture_id_offset = DEFAULT_PICTURE_ID_OFFSET;
|
||||||
gst_rtp_vp9_pay_picture_id_reset (obj);
|
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,
|
GST_TYPE_RTP_VP9_PAY_PICTURE_ID_MODE, DEFAULT_PICTURE_ID_MODE,
|
||||||
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
|
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_element_class_add_static_pad_template (element_class,
|
||||||
&gst_rtp_vp9_pay_sink_template);
|
&gst_rtp_vp9_pay_sink_template);
|
||||||
gst_element_class_add_static_pad_template (element_class,
|
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);
|
rtpvp9pay->picture_id_mode = g_value_get_enum (value);
|
||||||
gst_rtp_vp9_pay_picture_id_reset (rtpvp9pay);
|
gst_rtp_vp9_pay_picture_id_reset (rtpvp9pay);
|
||||||
break;
|
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:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
@ -190,6 +218,9 @@ gst_rtp_vp9_pay_get_property (GObject * object,
|
||||||
case PROP_PICTURE_ID_MODE:
|
case PROP_PICTURE_ID_MODE:
|
||||||
g_value_set_enum (value, rtpvp9pay->picture_id_mode);
|
g_value_set_enum (value, rtpvp9pay->picture_id_mode);
|
||||||
break;
|
break;
|
||||||
|
case PROP_PICTURE_ID_OFFSET:
|
||||||
|
g_value_set_int (value, rtpvp9pay->picture_id_offset);
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -60,6 +60,7 @@ struct _GstRtpVP9Pay
|
||||||
guint width;
|
guint width;
|
||||||
guint height;
|
guint height;
|
||||||
GstVP9RtpPayPictureIDMode picture_id_mode;
|
GstVP9RtpPayPictureIDMode picture_id_mode;
|
||||||
|
gint picture_id_offset;
|
||||||
guint16 picture_id;
|
guint16 picture_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue