When attempting to get yuv video data from Matrice 600, it works correctly about 5% of the time. But most of the time, I never receive onYUVDataCallback. When I check the decoder status with DJICodecManager.isDecoderOK()
, I receive false. For the rare occasions that it does work, isDecoderOK() returns true.
I'm using dependencies as below
implementation ('com.dji:dji-sdk:4.14')
compileOnly ('com.dji:dji-sdk-provided:4.14')
api ('com.dji:dji-uxsdk:4.14',
{ exclude group: 'com.amap.api' }
)
I'm creating the codec manager, enabling yuvdata and setting the yuv callback to this which implements DJICodecManager.YuvDataCallback
this.djiCodecManager = new DJICodecManager(context.getApplicationContext(), (SurfaceTexture)null, 0, 0, UsbAccessoryService.VideoStreamSource.Camera);
this.djiCodecManager.enabledYuvData(true);
this.djiCodecManager.setYuvDataCallback(this);
I create the data listener and add it to the callback. I always get data in the videoDataListener. I then sendDataToDecoder. But I don't receive a callbcak in onYUVDataReceived (except in very rare circumstances which I'm not sure why it works sometimes and sometimes not.) It works reliably for other DJI drones. The only change I've made for Matrice 600 is using getSecondaryVideoFeed() instead of getPrimaryVideoFeed().
this.videoDataListener = (data, size) -> {
counter++;
djiCodecManager.sendDataToDecoder(data, size);
}
if (VideoFeeder.getInstance().getSecondaryVideoFeed() != null && this.videoDataListener != null) {
VideoFeeder.getInstance().getSecondaryVideoFeed().addVideoDataListener(this.videoDataListener);
}
So far I've tried provideTranscodedVideoFeed(), getPrimaryVideoFeed(). What could be the cause of DJICodecManager isDecoderOK() returning false and do you have any ideas how to fix?
The fix for me was to add the DJI gradle dependencies to the main app module in addition to my dynamic module which contained all my dji related code and already had the dependencies.
There must be a better way to do this since the whole point of splitting the DJI sdk stuff outside of the main app module and into a dynamic module was to reduce the app to a size deployable to Google Play as a bundle.