roleoroleo / yi-hack-MStar

Custom firmware for Yi 1080p camera based on MStar platform
GNU General Public License v3.0
835 stars 110 forks source link

MTU is 1200 bytes -> packet fragmentation #464

Closed robho closed 1 year ago

robho commented 1 year ago

In /home/app/script/default.script the MTU for wlan0 interface is set to 1200 bytes:

echo "1200" > /sys/class/net/wlan0/mtu

This means that many of the RTP packets sent by the RTSP server need to be fragmented into two packets.

I've removed the MTU change and am now using the default of 1500 bytes. It looks to work well for me and now all RTP packets are sent without being fragmented. But I've only tested local playback, I don't use the cloud services.

Do you know if there's a good reason for lowering the MTU? It may be a good idea to use the default MTU size and let other network devices deal with fragmentation if these other devices need to lower the MTU to reach the destination.

roleoroleo commented 1 year ago

If I remember correctly, video packets are about 1000 bytes, so probably it does not depend on the MTU. But I will check it.

robho commented 1 year ago

Here's a screenshot from wireshark with MTU = 1200: image .. and here's a screenshot from wireshark with default MTU (1500): image

roleoroleo commented 1 year ago

You are right. Packets are 1k when you use yi protocol (app) but not when you use rtsp.

roleoroleo commented 1 year ago

I will test this change with all other features. If ok I will add it to the next release.

roleoroleo commented 1 year ago

I tested your changes with the app and I didn't notice any problem. And the performance is better. So I will add it to the startup script. I think it's not enough because the wifi script probably updates mtu frequently. I will also add it to the watchdog script.

Thank you for your help.

robho commented 1 year ago

Great!

Is the reason for not modifying default.script that the user should be able to uninstall yi-hack?

roleoroleo commented 1 year ago

Yes. I prefer to work only on the hack files. And I don't know if default.script is the only file involved in this procedure.

robho commented 1 year ago

Fixed by 48fd5b35f9e27b1969faeea8c19de56ed74755bb and included in release 0.4.8 -> closing this one