mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-27 04:01:08 +00:00
rtpmanager: consider UDP and IP headers in bandwidth calculation
According to RFC3550 lower-level headers should be considered for
bandwidth calculation.
See https://tools.ietf.org/html/rfc3550#section-6.2 paragraph 4:
Bandwidth calculations for control and data traffic include
lower-layer transport and network protocols (e.g., UDP and IP) since
that is what the resource reservation system would need to know.
Fix the source data to accommodate that.
Assume UDPv4 over IP for now, this is a simplification but it's good
enough for now.
While at it define a constant and use that instead of a magic number.
NOTE: this change basically reverts the logic of commit 529f443a6
(rtpsource: use payload size to estimate bitrate, 2010-03-02)
This commit is contained in:
parent
4146dc905d
commit
9d800cad43
3 changed files with 7 additions and 4 deletions
|
@ -673,7 +673,7 @@ rtp_session_init (RTPSession * sess)
|
||||||
sess->rtcp_rs_bandwidth = DEFAULT_RTCP_RS_BANDWIDTH;
|
sess->rtcp_rs_bandwidth = DEFAULT_RTCP_RS_BANDWIDTH;
|
||||||
|
|
||||||
/* default UDP header length */
|
/* default UDP header length */
|
||||||
sess->header_len = 28;
|
sess->header_len = UDP_IP_HEADER_OVERHEAD;
|
||||||
sess->mtu = DEFAULT_RTCP_MTU;
|
sess->mtu = DEFAULT_RTCP_MTU;
|
||||||
|
|
||||||
sess->probation = DEFAULT_PROBATION;
|
sess->probation = DEFAULT_PROBATION;
|
||||||
|
|
|
@ -1188,8 +1188,8 @@ update_receiver_stats (RTPSource * src, RTPPacketInfo * pinfo,
|
||||||
src->stats.octets_received += pinfo->payload_len;
|
src->stats.octets_received += pinfo->payload_len;
|
||||||
src->stats.bytes_received += pinfo->bytes;
|
src->stats.bytes_received += pinfo->bytes;
|
||||||
src->stats.packets_received += pinfo->packets;
|
src->stats.packets_received += pinfo->packets;
|
||||||
/* for the bitrate estimation */
|
/* for the bitrate estimation consider all lower level headers */
|
||||||
src->bytes_received += pinfo->payload_len;
|
src->bytes_received += pinfo->bytes;
|
||||||
|
|
||||||
GST_LOG ("seq %u, PC: %" G_GUINT64_FORMAT ", OC: %" G_GUINT64_FORMAT,
|
GST_LOG ("seq %u, PC: %" G_GUINT64_FORMAT ", OC: %" G_GUINT64_FORMAT,
|
||||||
seqnr, src->stats.packets_received, src->stats.octets_received);
|
seqnr, src->stats.packets_received, src->stats.octets_received);
|
||||||
|
@ -1319,7 +1319,7 @@ rtp_source_send_rtp (RTPSource * src, RTPPacketInfo * pinfo)
|
||||||
/* update stats for the SR */
|
/* update stats for the SR */
|
||||||
src->stats.packets_sent += pinfo->packets;
|
src->stats.packets_sent += pinfo->packets;
|
||||||
src->stats.octets_sent += pinfo->payload_len;
|
src->stats.octets_sent += pinfo->payload_len;
|
||||||
src->bytes_sent += pinfo->payload_len;
|
src->bytes_sent += pinfo->bytes;
|
||||||
|
|
||||||
running_time = pinfo->running_time;
|
running_time = pinfo->running_time;
|
||||||
|
|
||||||
|
|
|
@ -27,6 +27,9 @@
|
||||||
#include <gst/rtp/rtp.h>
|
#include <gst/rtp/rtp.h>
|
||||||
#include <gio/gio.h>
|
#include <gio/gio.h>
|
||||||
|
|
||||||
|
/* UDP/IP is assumed for bandwidth calculation */
|
||||||
|
#define UDP_IP_HEADER_OVERHEAD 28
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* RTPSenderReport:
|
* RTPSenderReport:
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in a new issue