Reputation: 223
I am currently developing an Android application using your SDK. This application is supposed to connect to a Mavic Pro drone in order to receive its video stream and other relevant data.
This application works well when the phone is connected to the drone via WiFi, however, the video stream is corrupted when the phone is connected via the remote controller.
To receive the video frames, I use the following code :
// Callback fired when receiving a new frame of 'size' bytes
VideoFeeder.getInstance().getPrimaryVideoFeed().setCallback((bytes, size) -> {
if (codecManager != null) {
// Shows the video in a "SurfaceTexture" on the phone
codecManager.sendDataToDecoder(bytes, size, UsbAccessoryService.VideoStreamSource.Camera.getIndex());
DroneVideoFrame videoFrame = new DroneVideoFrame(bytes, size, getVideoWidth(), getVideoHeight());
}
});
As mentioned above, this snippet works perfectly when connecting to the drone via WiFi. To be exact, each frame contains ~2000 bytes of data, the video is in 1280x720p in 24fps. The resulting video quality is perfect.
However, when using the remote controller, the data I get is completely different. While the "size" variable tells me that the received frame weighs ~2000 bytes, the frame itself (contained in the variable named "bytes") weighs more than 30 kilobytes. Moreover, this 30 Kb frame seems to be corrupted as it mostly contains what I recognize as buffer bytes (a long sequence of 0's).
Also, the functions "getVideoWidth" and "getVideoHeight" return respectively "9px" and "16px", which is obviously wrong. Moreover thoses function return correct values when using the drone WiFi.
What I have tried :
Update the firmware
Update DJI Go 4 application.
Truncate the buffer bytes (sequences of '0') seen in the frame. This results in a video full of artifacts as seen in the following image
System information :
Drone : DJI Mavic Pro, firmware up to date as of 09 July 2018
Phone : Panasonic FZ-N1 "Toughpad" - Android version : 6.0.1
Would you have any idea what causes that corruption ?
Upvotes: 0
Views: 198
Reputation: 1915
You have to rule out the problem one by one
(1) Can try downgrade one version? it would be a firmware issue. DJI is known to have this sort of problem. Latest doesn't mean safest. For consumer product review, you can refer to here https://forum.dji.com/thread-120739-1-1.html.
If you are a DJI partner, you can call them to confirm on firmware. Today we just had some firmware issue with M200 and PSDK. And we msgs them and they quickly replied. We have to change the firmware to enable gimbal power control for DJI PSDK.
(2) Change a RF spectrum, say from 15 to 18. To make sure it is not because of some frequency hopping or intentional jamming from other people
(3) If changing firmware version and RF doesn't help, try to borrow a 2nd set and run the same code to rule out the hardware issue e.g broken rf link.
(4) If you borrowed a drone and they all have the same problem, then it could be somewhere in your code, there is a bug.
Thats all i can think so far. Ill add if I remember something else
Upvotes: 0