Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/GStreamer/gst-plugins-good.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/gst
diff options
context:
space:
mode:
authorTulio Beloqui <tulio.beloqui@pexip.com>2021-04-13 17:19:22 +0300
committerGStreamer Marge Bot <gitlab-merge-bot@gstreamer-foundation.org>2021-08-25 11:36:06 +0300
commit266c2d06198030bb523c37ef1b27f96e639f965f (patch)
tree830953b5642be13cc295017d1f82d387fc0b765c /gst
parent0440cb12debc4db811489227258418d98837474d (diff)
rtptwcc: changes to use rtp buffer arrival time and current time.
For TWCC we are more interested to track the arrival time (receive side) and the current time (sender side) of the buffers rather than the running time. Part-of: <https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/-/merge_requests/927>
Diffstat (limited to 'gst')
-rw-r--r--gst/rtpmanager/rtpsession.c2
-rw-r--r--gst/rtpmanager/rtpstats.h2
-rw-r--r--gst/rtpmanager/rtptwcc.c15
3 files changed, 14 insertions, 5 deletions
diff --git a/gst/rtpmanager/rtpsession.c b/gst/rtpmanager/rtpsession.c
index 9bd537c93..84fbfee22 100644
--- a/gst/rtpmanager/rtpsession.c
+++ b/gst/rtpmanager/rtpsession.c
@@ -2172,9 +2172,11 @@ update_packet_info (RTPSession * sess, RTPPacketInfo * pinfo,
res =
gst_buffer_list_foreach (list, (GstBufferListFunc) update_packet,
pinfo);
+ pinfo->arrival_time = GST_CLOCK_TIME_NONE;
} else {
GstBuffer *buffer = GST_BUFFER_CAST (data);
res = update_packet (&buffer, 0, pinfo);
+ pinfo->arrival_time = GST_BUFFER_DTS (buffer);
}
return res;
diff --git a/gst/rtpmanager/rtpstats.h b/gst/rtpmanager/rtpstats.h
index 1804aa6cf..4b08e1629 100644
--- a/gst/rtpmanager/rtpstats.h
+++ b/gst/rtpmanager/rtpstats.h
@@ -70,6 +70,7 @@ typedef struct {
* @address: address of the sender of the packet
* @current_time: current time according to the system clock
* @running_time: time of a packet as buffer running_time
+ * @arrival_time: time of arrival of a packet
* @ntpnstime: time of a packet NTP time in nanoseconds
* @header_len: number of overhead bytes per packet
* @bytes: bytes of the packet including lowlevel overhead
@@ -92,6 +93,7 @@ typedef struct {
GSocketAddress *address;
GstClockTime current_time;
GstClockTime running_time;
+ GstClockTime arrival_time;
guint64 ntpnstime;
guint header_len;
guint bytes;
diff --git a/gst/rtpmanager/rtptwcc.c b/gst/rtpmanager/rtptwcc.c
index bcb4fc02c..691428c21 100644
--- a/gst/rtpmanager/rtptwcc.c
+++ b/gst/rtpmanager/rtptwcc.c
@@ -159,7 +159,11 @@ recv_packet_init (RecvPacket * packet, guint16 seqnum, RTPPacketInfo * pinfo)
{
memset (packet, 0, sizeof (RecvPacket));
packet->seqnum = seqnum;
- packet->ts = pinfo->running_time;
+
+ if (GST_CLOCK_TIME_IS_VALID (pinfo->arrival_time))
+ packet->ts = pinfo->arrival_time;
+ else
+ packet->ts = pinfo->current_time;
}
static guint8
@@ -784,7 +788,7 @@ rtp_twcc_manager_recv_packet (RTPTWCCManager * twcc, RTPPacketInfo * pinfo)
GST_LOG ("Receive: twcc-seqnum: %u, pt: %u, marker: %d, ts: %"
GST_TIME_FORMAT, seqnum, pinfo->pt, pinfo->marker,
- GST_TIME_ARGS (pinfo->running_time));
+ GST_TIME_ARGS (pinfo->arrival_time));
if (!pinfo->marker)
twcc->packet_count_no_marker++;
@@ -841,7 +845,7 @@ static void
sent_packet_init (SentPacket * packet, guint16 seqnum, RTPPacketInfo * pinfo)
{
packet->seqnum = seqnum;
- packet->ts = pinfo->running_time;
+ packet->ts = pinfo->current_time;
packet->size = pinfo->payload_len;
packet->pt = pinfo->pt;
packet->remote_ts = GST_CLOCK_TIME_NONE;
@@ -864,8 +868,9 @@ rtp_twcc_manager_send_packet (RTPTWCCManager * twcc, RTPPacketInfo * pinfo)
g_array_append_val (twcc->sent_packets, packet);
- GST_LOG ("Send: twcc-seqnum: %u, pt: %u, marker: %d, ts: %" GST_TIME_FORMAT,
- seqnum, pinfo->pt, pinfo->marker, GST_TIME_ARGS (pinfo->running_time));
+ GST_LOG ("Send: twcc-seqnum: %u, pt: %u, marker: %d, ts: %"
+ GST_TIME_FORMAT, seqnum, pinfo->pt, pinfo->marker,
+ GST_TIME_ARGS (pinfo->current_time));
}
static void