Rapptz / discord.py

An API wrapper for Discord written in Python.
http://discordpy.rtfd.org/en/latest
MIT License
14.94k stars 3.77k forks source link

Is it possible to determine the outbound packet loss (in voice channels)? #2225

Open KowalskiThomas opened 5 years ago

KowalskiThomas commented 5 years ago

I asked about that in the discord.py Discord yesterday, and got an "I think not" answer, so I figured I'd ask here, just to be sure.

I'd like to find out the outbound packet loss for my bot when it is connected to a voice channel. I haven't found anything in the docs for that, though, so I was wondering if there was something implemented for that and, if not, if there was a way to do it without reinventing the wheel.

Thanks for your awesome work!

imayhaveborkedit commented 5 years ago

Good news, you actually can. Bad news, its part of voice receive. The one type of RTC control packet discord sends (as far as I can tell) is the ReceiverReport type, which has some statistics for the data you send. They look like this:

<ReceiverReportPacket report_count: 1, ssrc: 13, reports: (RReport(ssrc=13, perc_loss=0, total_lost=0, last_seq=453, jitter=3, lsr=0, dlsr=2432705982),), extension: None>

Checking this has also made me notice that currently (in my voice recv fork) that to receive packets about your send statistics you need to have a listener attached, even if it does nothing. This is obvious from a logical perspective but backwards from a library usage perspective. I suppose i'll have to design this in as some sort of special sink or something.