meetecho / janus-gateway

Janus WebRTC Server
https://janus.conf.meetecho.com
GNU General Public License v3.0
8.27k stars 2.48k forks source link

[1.2.3] Streaming Plugin watch, too many video sequence errors #3479

Closed joshuaRosales closed 5 days ago

joshuaRosales commented 6 days ago

What version of Janus is this happening on? Put the version and the commit identifier (available in version.c or from an info request) here

#include "version.h"
const char *janus_build_git_sha = "f727ba891f13c5d2bd5210c937124fee3aea832e";
const char *janus_build_git_time = "Fri May 31 20:19:21 UTC 2024";
int janus_version = 1203;
const char *janus_version_string = "1.2.3";
const char *libnice_version_string = "0.1.22";

Have you tested a more recent version of Janus too? Yes/no. If yes, which one. If not, why.

No. May 2024 is pretty recent.

Was this working before? If you have information on a version/commit where the issue wasn't there (e.g., the result of a git bisect), please provide it here.

Not sure.

Is there a gdb or libasan trace of the issue? If you have a trace related to the issue (e.g., after a segfault), provide it as a gist/pastebin/other link here, or as a collapsible section. Do NOT paste logs inline. For more information on the kind of traces we may find useful, please refer to the documentation.

No. I have pcap files though.

Additional context Add any other context about the problem here.

I'm seeing a lot of sequence errors in the RTP packets when watching a stream. This is for a single mountpoint and a single client watching. The RTP packets that I send to the mountpoint are generated by gstreamer. I made use of Janus' mountpoint recording feature which gives me .mjr files, which I then converted into pcap files, and what I noticed is that the timings and sequence numbers are good in the mountpoint recordings. The audio file conversion:

/opt/janus/bin/mjr2pcap 4343652548245139-audio.mjr 4343652548245139-audio.p
cap
/opt/janus/bin/mjr2pcap: /usr/lib/x86_64-linux-gnu/libjansson.so.4: no version information available (required by /opt/janus/bin/mjr2pcap)
Janus version: 1203 (1.2.3)
Janus commit: f727ba891f13c5d2bd5210c937124fee3aea832e
Compiled on:  Fri May 31 20:19:21 UTC 2024

4343652548245139-audio.mjr --> 4343652548245139-audio.pcap
File is 20480 bytes
Pre-parsing file...
Traversing RTP packets...
[WARN]   -- Failed to read packet (4 != 13 bytes), skipping
4343652548245139-audio.pcap is 35387 bytes
Bye!

The video pcap conversion:

/opt/janus/bin/mjr2pcap: /usr/lib/x86_64-linux-gnu/libjansson.so.4: no version information available (required by /opt/janus/bin/mjr2pcap)
Janus version: 1203 (1.2.3)
Janus commit: f727ba891f13c5d2bd5210c937124fee3aea832e
Compiled on:  Fri May 31 20:19:21 UTC 2024

4343652548245139-video.mjr --> 4343652548245139-video.pcap
File is 512000 bytes
Pre-parsing file...
Traversing RTP packets...
[WARN]   -- Failed to read packet (319 != 368 bytes), skipping
4343652548245139-video.pcap is 533313 bytes
Bye!

However, I also recorded the network activity on the server:

sudo tcpdump -i any -s 96 -B 4096 -w capture.pcap -n -v "udp or tcp"
tcpdump: data link type LINUX_SLL2
tcpdump: listening on any, link-type LINUX_SLL2 (Linux cooked v2), snapshot length 96 bytes
^C6394 packets captured
8415 packets received by filter
0 packets dropped by kernel

And this capture.pcap file has sequence numbers which are messed up. Any idea why that is? I imagine since this is on the host itself, it is not a network issue, and since the input is good in the mountpoint recordings, I'm thinking it's a misconfiguration or a bug with Janus/ the streaming plugin.

I'll put some screenshots of what I'm seeing, so y'all can better understand the issue I'm noticing. The video is 256x256, 25fps, vp8 encoding. Video packets sent every 40ms. The audio is opus encoding. Audio packets sent every 20ms.

Input to mountpoint audio and video (from mjr2pcap) seem clean: Input to mountpoint audio sequence seems clean: image Input to mountpoint video sequence seems clean: image Input to mountpoint audio timing, pretty good: image Input to mountpoint video timing, pretty good: image

The following is from the tcpdump source collected on the host -- the media streamed via webrtc: Audio doesn't have sequence errors: image

Wrong sequence numbers in wireshark for the video stream: image

The timing also is a bit off in certain spots: image

I'd appreciate any help in troubleshooting the issue. If y'all want to look at the pcap files, I can share those too, but I'd rather do that through a more secure medium than just posting it on github. I'll continue experimenting and posting results as I find them.

atoppi commented 5 days ago

The sequence errors in your video stream dump are due to LOST packets, not misordering. I also noticed that traffic inbound to janus mp (gstreamer -> mountpint) is IPv4, whereas traffic towards your client is IPv6. Maybe there is some problem with the MTU over IPv6? Just guessing: packet larger than X are being dropped somehow.

lminiero commented 5 days ago

At any rate, nothing that should be fixed in Janus, so we can close this issue.