Commit c7579d31 authored by Håvard Graff's avatar Håvard Graff Committed by Olivier Crête

rtpmux: fix PROP_TIMESTAMP_OFFSET range problems

It could not set the offset for the full guint32 range.
parent 7ad72661
......@@ -124,7 +124,6 @@ gst_rtp_mux_class_init (GstRTPMuxClass * klass)
gobject_class = (GObjectClass *) klass;
gstelement_class = (GstElementClass *) klass;
gst_element_class_add_static_pad_template (gstelement_class, &src_factory);
gst_element_class_add_static_pad_template (gstelement_class, &sink_factory);
......@@ -138,21 +137,25 @@ gst_rtp_mux_class_init (GstRTPMuxClass * klass)
klass->src_event = gst_rtp_mux_src_event_real;
g_object_class_install_property (G_OBJECT_CLASS (klass),
PROP_TIMESTAMP_OFFSET, g_param_spec_int ("timestamp-offset",
"Timestamp Offset",
"Offset to add to all outgoing timestamps (-1 = random)", -1,
G_MAXINT, DEFAULT_TIMESTAMP_OFFSET,
g_object_class_install_property (gobject_class, PROP_TIMESTAMP_OFFSET,
g_param_spec_int64 ("timestamp-offset", "Timestamp Offset",
"Offset to add to all outgoing timestamps (-1 = random)",
-1, G_MAXUINT32, DEFAULT_TIMESTAMP_OFFSET,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SEQNUM_OFFSET,
g_object_class_install_property (gobject_class, PROP_SEQNUM_OFFSET,
g_param_spec_int ("seqnum-offset", "Sequence number Offset",
"Offset to add to all outgoing seqnum (-1 = random)", -1, G_MAXINT,
DEFAULT_SEQNUM_OFFSET, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SEQNUM,
"Offset to add to all outgoing seqnum (-1 = random)",
-1, G_MAXUINT16, DEFAULT_SEQNUM_OFFSET,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_SEQNUM,
g_param_spec_uint ("seqnum", "Sequence number",
"The RTP sequence number of the last processed packet",
0, G_MAXUINT, 0, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_SSRC,
0, G_MAXUINT, 0,
G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_SSRC,
g_param_spec_uint ("ssrc", "SSRC",
"The SSRC of the packets (default == random)",
0, G_MAXUINT, DEFAULT_SSRC,
......@@ -351,8 +354,10 @@ gst_rtp_mux_readjust_rtp_timestamp_locked (GstRTPMux * rtp_mux,
ts = gst_rtp_buffer_get_timestamp (rtpbuffer) - sink_ts_base +
rtp_mux->ts_base;
GST_LOG_OBJECT (rtp_mux, "Re-adjusting RTP ts %u to %u",
gst_rtp_buffer_get_timestamp (rtpbuffer), ts);
GST_LOG_OBJECT (rtp_mux,
"Re-adjusting RTP ts %u to %u (sink_ts_base = %u, rtp_mux->ts_base=%u)",
gst_rtp_buffer_get_timestamp (rtpbuffer),
ts, sink_ts_base, rtp_mux->ts_base);
gst_rtp_buffer_set_timestamp (rtpbuffer, ts);
}
......@@ -810,7 +815,7 @@ gst_rtp_mux_get_property (GObject * object,
GST_OBJECT_LOCK (rtp_mux);
switch (prop_id) {
case PROP_TIMESTAMP_OFFSET:
g_value_set_int (value, rtp_mux->ts_offset);
g_value_set_int64 (value, rtp_mux->ts_offset);
break;
case PROP_SEQNUM_OFFSET:
g_value_set_int (value, rtp_mux->seqnum_offset);
......@@ -838,7 +843,7 @@ gst_rtp_mux_set_property (GObject * object,
switch (prop_id) {
case PROP_TIMESTAMP_OFFSET:
rtp_mux->ts_offset = g_value_get_int (value);
rtp_mux->ts_offset = g_value_get_int64 (value);
break;
case PROP_SEQNUM_OFFSET:
rtp_mux->seqnum_offset = g_value_get_int (value);
......
......@@ -43,7 +43,7 @@ typedef struct _GstRTPMuxClass GstRTPMuxClass;
typedef struct
{
gboolean have_timestamp_offset;
guint timestamp_offset;
guint32 timestamp_offset;
GstSegment segment;
......@@ -66,8 +66,9 @@ struct _GstRTPMux
guint32 ts_base;
guint16 seqnum_base;
gint32 ts_offset;
gint16 seqnum_offset;
gint64 ts_offset;
gint seqnum_offset;
guint16 seqnum; /* protected by object lock */
guint ssrc;
guint current_ssrc;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment