rtpsource: fix stats for queued packets
When packets are queued in rtpsource (for example during source probation) their stats are not considered, they are usually only a few packets but maybe it's worth keeping track of their stats for completeness.
When looking at this I noticed two things:
-
src->stats.bytes_received
is never used in the current code, because a separate variablesrc->bytes_received
is used for bitrate estimation after c971d1a9 -
src->stats.bytes_received
takes into account the lower level header overhead too, but this is not used when settingsrc->bytes_received
for bitrate estimation: https://gitlab.freedesktop.org/gstreamer/gst-plugins-good/blob/435f67debfddbb10bb7a740e38abcee2e2dd8359/gst/rtpmanager/rtpsource.c#L1189
So I am marking the MR as WIP and asking the following question:
Should lower level overhead been taken into account also for bitrate estimation?
If it should then a change like the following could make sense:
diff --git a/gst/rtpmanager/rtpsource.c b/gst/rtpmanager/rtpsource.c
index aef681f57..b7d40b519 100644
--- a/gst/rtpmanager/rtpsource.c
+++ b/gst/rtpmanager/rtpsource.c
@@ -1214,7 +1214,7 @@ update_receiver_stats (RTPSource * src, RTPPacketInfo * pinfo,
src->stats.bytes_received += pinfo->bytes;
src->stats.packets_received += pinfo->packets;
/* for the bitrate estimation */
- src->bytes_received += pinfo->payload_len;
+ src->bytes_received += pinfo->bytes;
GST_LOG ("seq %u, PC: %" G_GUINT64_FORMAT ", OC: %" G_GUINT64_FORMAT,
seqnr, src->stats.packets_received, src->stats.octets_received);
If it shoudln't then maybe lower level overhead can be removed from pinfo->bytes
, and consequently from stats.bytes_received
too.
This would also affect some tests I am writing to check stats values after pushing packets.
Thanks, Antonio