hanyazou / TelloPy

DJI Tello drone controller python package
Other
690 stars 293 forks source link

Detect missing packet & drop frame #20

Closed clydemcqueen closed 6 years ago

clydemcqueen commented 6 years ago

https://github.com/hanyazou/TelloPy/blob/82d4e33da7f50af5833feb0a6a4bd26dd9194e81/tellopy/_internal/video_stream.py#L47

I looked at the 1st 2 bytes in the video UDP packets, and they seem to consist of a frame# and packet#. Occasionally a packet is lost, and the resulting frame (and downstream frames) are corrupt. It should be possible to notice that a packet is missing, and drop bad frame(s).

hanyazou commented 6 years ago

That 1st sequence byte was checked in tello.py and the check routine noticed packet loss if it detect some. Here is example:

Tello: 11:58:23.021: Info: video data 750514 bytes 366.1KB/sec loss=1

I added some lines to check 2nd byte in the video packet in fb5cfab17a41b6a2881076f2c978e6f39d988d20.

I tried dropping bad frame also. There was no improvement in the displayed video because of interframe prediction.