DJI-Mobile-SDK-Tutorials / Android-VideoStreamDecodingSample

This sample project demonstrates how to use FFmpeg for video frame parsing and to use MediaCodec for hardware decoding on DJI Products.
MIT License
169 stars 80 forks source link

Q: Would you mind to elaborate a little change between 4.9 and 4.10? #55

Open neilyoung opened 5 years ago

neilyoung commented 5 years ago

Removed and corrected below...

neilyoung commented 5 years ago

And what is the mystery behind this?

                    if (Build.VERSION.SDK_INT <= 23){
                        oldSaveYuvDataToJPEG(bytes, width, height);
                    }else {
                        newSaveYuvDataToJPEG(bytes, width, height);
                    }

What has the SDK version to do with this?

neilyoung commented 5 years ago

Oh, WTF.. .my post is scrambled. Here again:

I'm talking about this routine in the sample:

First there is a bug: To test yuvFrame.length to be >= withheight is necessary, but not sufficient. Actually .length has to be tested to be exactly 1.5 widht * height.

Then please confirm: Am I seeing this correctly

??

 private void newSaveYuvDataToJPEG(byte[] yuvFrame, int width, int height){
        if (yuvFrame.length < width * height) {
            //DJILog.d(TAG, "yuvFrame size is too small " + yuvFrame.length);
            return;
        }
        int length = width * height;

        byte[] u = new byte[width * height / 4];
        byte[] v = new byte[width * height / 4];
        for (int i = 0; i < u.length; i++) {
            v[i] = yuvFrame[length + 2 * i];
            u[i] = yuvFrame[length + 2 * i + 1];
        }
        for (int i = 0; i < u.length; i++) {
            yuvFrame[length + 2 * i] = u[i];
            yuvFrame[length + 2 * i + 1] = v[i];
        }
        screenShot(yuvFrame,Environment.getExternalStorageDirectory() + "/DJI_ScreenShot", width, height);
    }

later

YuvImage yuvImage = new YuvImage(buf,
                ImageFormat.NV21,
                width,
                height,
                null);

I'm having a ticket open at your support regarding this (24417). No answer yet. Would you mind to explain?

Michael-DJI commented 5 years ago

Hey @neilyoung, thanks for the feedback! we have received your ticket (24417), it will be delivered to our developer soon, if the developer give the feedback, we will reply your email ASAP, thanks! BTW we might need you to provide some info regarding this issue, please check the email later, thanks again!

dji-dev commented 5 years ago

Public comment from Luce Luo in Zendesk ticket #24678:

Dear Customer,

Thank you for contacting DJI.
To collect questions in detail, please fill in the form below, including your context, mobile device and android system info, and we will handle this ticket as soon as we receive it.
https://formcrafts.com/a/dji-developer-feedback-en

Thanks,

Luce Luo
DJI Dev Team

neilyoung commented 5 years ago

@dji-dev It is not an issue, it is just a question. Maybe all the problems are gone if you answer me to 24417 :)

neilyoung commented 5 years ago

https://github.com/accuware/djistreamerlib

Maybe this is of interest in this case