mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-12-28 19:20:35 +00:00
gst-libs/gst/rtp/gstbasertppayload.c: Make sure we start our RTP timestamp from the random base RTP timestamp even if...
Original commit message from CVS: * gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_event), (gst_basertppayload_set_outcaps), (gst_basertppayload_push), (gst_basertppayload_change_state): Make sure we start our RTP timestamp from the random base RTP timestamp even if the buffer timestamp starts from some random value.
This commit is contained in:
parent
7eb8a5d24a
commit
06ded6258e
2 changed files with 25 additions and 4 deletions
|
@ -1,3 +1,11 @@
|
|||
2007-09-14 Wim Taymans <wim.taymans@gmail.com>
|
||||
|
||||
* gst-libs/gst/rtp/gstbasertppayload.c: (gst_basertppayload_event),
|
||||
(gst_basertppayload_set_outcaps), (gst_basertppayload_push),
|
||||
(gst_basertppayload_change_state):
|
||||
Make sure we start our RTP timestamp from the random base RTP
|
||||
timestamp even if the buffer timestamp starts from some random value.
|
||||
|
||||
2007-09-14 Wim Taymans <wim.taymans@gmail.com>
|
||||
|
||||
* configure.ac:
|
||||
|
|
|
@ -45,6 +45,8 @@ struct _GstBaseRTPPayloadPrivate
|
|||
gboolean seqnum_offset_random;
|
||||
gboolean ssrc_random;
|
||||
guint16 next_seqnum;
|
||||
|
||||
GstClockTime rt_base;
|
||||
};
|
||||
|
||||
/* BaseRTPPayload signals and args */
|
||||
|
@ -364,8 +366,9 @@ gst_basertppayload_event (GstPad * pad, GstEvent * event)
|
|||
&position);
|
||||
gst_segment_set_newsegment (&basertppayload->segment, update, rate, fmt,
|
||||
start, stop, position);
|
||||
}
|
||||
|
||||
/* fallthrough */
|
||||
}
|
||||
default:
|
||||
res = gst_pad_event_default (pad, event);
|
||||
break;
|
||||
|
@ -467,7 +470,6 @@ gst_basertppayload_set_outcaps (GstBaseRTPPayload * payload, gchar * fieldname,
|
|||
va_end (varargs);
|
||||
}
|
||||
|
||||
|
||||
/* the peer caps can override some of the defaults */
|
||||
peercaps = gst_pad_peer_get_caps (payload->srcpad);
|
||||
if (peercaps == NULL) {
|
||||
|
@ -610,9 +612,18 @@ gst_basertppayload_push (GstBaseRTPPayload * payload, GstBuffer * buffer)
|
|||
if (GST_CLOCK_TIME_IS_VALID (timestamp)) {
|
||||
gint64 rtime;
|
||||
|
||||
rtime =
|
||||
gst_segment_to_running_time (&payload->segment, GST_FORMAT_TIME,
|
||||
rtime = gst_segment_to_running_time (&payload->segment, GST_FORMAT_TIME,
|
||||
timestamp);
|
||||
|
||||
/* take first timestamp as base, we want to calculate the RTP timestamp
|
||||
* starting from the ts_base */
|
||||
if (priv->rt_base == -1) {
|
||||
priv->rt_base = timestamp;
|
||||
GST_LOG_OBJECT (payload, "first timestamp %" GST_TIME_FORMAT,
|
||||
GST_TIME_ARGS (timestamp));
|
||||
}
|
||||
rtime -= priv->rt_base;
|
||||
|
||||
rtime = gst_util_uint64_scale_int (rtime, payload->clock_rate, GST_SECOND);
|
||||
|
||||
ts += rtime;
|
||||
|
@ -775,6 +786,8 @@ gst_basertppayload_change_state (GstElement * element,
|
|||
basertppayload->ts_base = g_rand_int (basertppayload->ts_rand);
|
||||
else
|
||||
basertppayload->ts_base = basertppayload->ts_offset;
|
||||
|
||||
priv->rt_base = -1;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue