dji-sdk / Mobile-SDK-Android-V5

MSDK V5 Sample
Other
282 stars 146 forks source link

YUV frames have distorted colors after rebooting M350 #410

Open wooldridgetm opened 2 months ago

wooldridgetm commented 2 months ago

YUV frames retrieved using MediaDataCenter CameraStreamManager have color distortions, which are delineated below.

This is how we're retrieving the YUV frames.

MediaDataCenter.getInstance().cameraStreamManager.addFrameListener(
    ComponentIndexType.LEFT_OR_MAIN,
    FrameFormat.YUV420_888,
    this
)

override fun onFrame(
    frameData: ByteArray,
    offset: Int,
    length: Int,
    width: Int,
    height: Int,
    format: FrameFormat
) {
    if (frameData.size < width * height) return

    // process the byte array
    processor.onFrame(frameData, width, height + offset, formaț, isDirect = true)
}

Steps to Reproduce:

  1. boot up M350 and connect it to the RC Plus
  2. Run the MSDK sample app
  3. click on testing tools
  4. click on Multi-Video Decoding (CameraStreamManager - New)
  5. w/o relaunching the app, reboot the M350 at least 3 x's.
  6. capture the image.
  7. examine the image - you will see that the colors do not align correctly.

image image

dji-dev commented 2 months ago

Agent comment from yating.liao in Zendesk ticket #116342:

Is the MSDK version you are using 5.8? This is a known issue with version 5.8. Please try the latest version.

°°°

wooldridgetm commented 2 months ago

Thanks; we're using v5.9.1. I will try to reproduce on v5.10.0 and report back.

dji-dev commented 2 months ago

Agent comment from yating.liao in Zendesk ticket #116342:

Thank you for your understanding.

°°°

wooldridgetm commented 2 months ago

We tried the latest SDK with the M350 using the steps delineated above - we still see the same issue. Please advise.

dji-dev commented 2 months ago

Agent comment from yating.liao in Zendesk ticket #116342:

I tested on the M350 using the method you described, and I did not encounter a similar issue. Did you use the correct photo dimensions when viewing the YUV images? The ReceiveStreamListener will push the width and height.

°°°

wooldridgetm commented 2 months ago

We're using the width, height, and offset from the CameraFrameListener; we're not using ReceiveStreamListener.

dji-dev commented 2 months ago

Agent comment from yating.liao in Zendesk ticket #116342:

The width and height obtained by CameraFrameListener and ReceiveStreamListener are the same. Would you be willing to share the file you tested with us?

Here is an upload link:https://pan-sec.djicorp.com/s/y6A8L55a84iEp4B password:dji123

°°°

wooldridgetm commented 2 months ago

I uploaded the sample apk named wooldridge-dji-yuv-problem.apk along with the zip file dji-sample-app.zip - this is the source code used to create that apk.

Instructions:

  1. Turn on a RC+ and M350 with an H20 attached
  2. Uninstall any existing versions of the MSDK Aircraft app on the RC+.
  3. Install the wooldridge-dji-yuv-problem.apk on the RC+.
  4. Launch the newly installed app.
  5. Click on Testing Tools image
  6. Click on Multi-Video Decoding (CameraStreamManager - New) 2
  7. Restart the drone several times w/o shutting down the app.
  8. Click capture 3
  9. This saves the YUV frame in an i420 format as a file in the Downloads directory on the RC+.
  10. The app now displays the adb command to copy that file from the RC+ as well as the width/height reported by CameraFrameListener 4
  11. Copy that newly created file from the RC+ using the adb command delineated in the app. 5
  12. Examine that file using pixpeep.mort.coffee in your browser
  13. Choose the file you copied over in step 11 and enter i420 as well as the width/height reported in step 10 6
  14. If you don't see green bars or misaligned colors, then restart the drone w/o restarting the app and repeat steps 8 - 13. Sometimes, it takes 6 drone restarts for this to occur, but it usually only takes 1 or 2 drone restarts.
dji-dev commented 2 months ago

Agent comment from yating.liao in Zendesk ticket #116342:

I have reproduced the issue you mentioned using H20. It seems that this problem does not occur with the FPV lens.

°°°