mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 12:11:13 +00:00
rtpbasepayload: timestamp bug, if rate control=no
With commit "basepayload: Expose onvif-no-rate-control property" the rtp timestamp changed behaviour when rate control is disabled. When disabling rate control, we must take care of the stream time to avoid the timestamps to begin from zero again.
This commit is contained in:
parent
1e9da26b68
commit
4152b0c840
2 changed files with 49 additions and 1 deletions
|
@ -1285,7 +1285,8 @@ gst_rtp_base_payload_prepare_push (GstRTPBasePayload * payload,
|
|||
|
||||
/* no offset, use the gstreamer pts */
|
||||
if (priv->onvif_no_rate_control)
|
||||
rtime_ns = data.pts;
|
||||
rtime_ns = gst_segment_to_stream_time (&payload->segment,
|
||||
GST_FORMAT_TIME, data.pts);
|
||||
else
|
||||
rtime_ns =
|
||||
gst_segment_to_running_time (&payload->segment, GST_FORMAT_TIME,
|
||||
|
|
|
@ -1925,6 +1925,51 @@ GST_START_TEST (rtp_base_payload_max_framerate_attribute)
|
|||
|
||||
GST_END_TEST;
|
||||
|
||||
GST_START_TEST (rtp_base_payload_segment_time)
|
||||
{
|
||||
State *state;
|
||||
guint32 timestamp_base = 0;
|
||||
guint segment_time = 10;
|
||||
GstEvent *event;
|
||||
GstSegment *segment = gst_segment_new ();
|
||||
|
||||
state =
|
||||
create_payloader
|
||||
("application/x-rtp",
|
||||
&sinktmpl, "onvif-no-rate-control", TRUE, "timestamp-offset",
|
||||
timestamp_base, NULL);
|
||||
|
||||
set_state (state, GST_STATE_PLAYING);
|
||||
|
||||
gst_segment_init (segment, GST_FORMAT_TIME);
|
||||
segment->time = segment_time * GST_SECOND;
|
||||
event = gst_event_new_segment (segment);
|
||||
fail_unless (gst_pad_push_event (state->srcpad, event));
|
||||
|
||||
push_buffer (state, "pts", 0 * GST_SECOND, NULL);
|
||||
push_buffer (state, "pts", 1 * GST_SECOND, NULL);
|
||||
push_buffer (state, "pts", 2 * GST_SECOND, NULL);
|
||||
push_buffer (state, "pts", 3 * GST_SECOND, NULL);
|
||||
|
||||
set_state (state, GST_STATE_NULL);
|
||||
|
||||
validate_buffers_received (4);
|
||||
|
||||
validate_buffer (0, "rtptime",
|
||||
timestamp_base + (segment_time) * DEFAULT_CLOCK_RATE, NULL);
|
||||
validate_buffer (1, "rtptime",
|
||||
timestamp_base + (1 + segment_time) * DEFAULT_CLOCK_RATE, NULL);
|
||||
validate_buffer (2, "rtptime",
|
||||
timestamp_base + (2 + segment_time) * DEFAULT_CLOCK_RATE, NULL);
|
||||
validate_buffer (3, "rtptime",
|
||||
timestamp_base + (3 + segment_time) * DEFAULT_CLOCK_RATE, NULL);
|
||||
|
||||
destroy_payloader (state);
|
||||
gst_segment_free (segment);
|
||||
}
|
||||
|
||||
GST_END_TEST;
|
||||
|
||||
static Suite *
|
||||
rtp_basepayloading_suite (void)
|
||||
{
|
||||
|
@ -1963,6 +2008,8 @@ rtp_basepayloading_suite (void)
|
|||
tcase_add_test (tc_chain, rtp_base_payload_framerate_attribute);
|
||||
tcase_add_test (tc_chain, rtp_base_payload_max_framerate_attribute);
|
||||
|
||||
tcase_add_test (tc_chain, rtp_base_payload_segment_time);
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue