str0m icon indicating copy to clipboard operation
str0m copied to clipboard

Receive Stun bytes not counted

Open xnorpx opened this issue 3 months ago • 3 comments

Ok, so this has bit us twice now, we don't see any recv bytes counted when we have no active streams. So figure it worth having an issue to track it.

There is no quick clean way to fix this, which is probably the reason it has a todo.

We switched to track the bytes outside str0m instead for now.

   let bytes_rx = match r.contents.inner {
            // TODO: stun is already parsed (depacketized) here
            Stun(_) => 0,
            Dtls(v) | Rtp(v) | Rtcp(v) => v.len(),
        };

https://github.com/algesten/str0m/blob/783b020ff7c859372884889e205c5c838792e97a/src/lib.rs#L1824C9-L1828C11

xnorpx avatar Sep 03 '25 20:09 xnorpx

Decision is to not count STUN in either direction.

algesten avatar Sep 04 '25 18:09 algesten

    /// Total bytes transmitted.
    pub peer_bytes_rx: u64,
    /// Total bytes received.
    pub peer_bytes_tx: u64,
    /// Total bytes transmitted, only counting media traffic (rtp payload).
    pub bytes_rx: u64,
    /// Total bytes received, only counting media traffic (rtp payload).
    pub bytes_tx: u64,

@k0nserv @xnorpx hang on. Aren't we supposed to count STUN in peer_bytes_..?

algesten avatar Sep 04 '25 18:09 algesten

Based on those comments it feels like peer_bytes_rx/tx should include stun as well. But yeah I am a little confused by the mapping.

xnorpx avatar Sep 04 '25 19:09 xnorpx