DJI-Mobile-SDK-Tutorials / Android-FPVDemo

This demo shows how to create a simple FPV view and how to take photo and record video using DJI Mobile SDK.
MIT License
62 stars 81 forks source link

Android DJI-Mobile-SDK is hogging CPU #25

Open ankitcreativearora opened 6 years ago

ankitcreativearora commented 6 years ago

Is this issue about bugs or crash issues of the Sample Code?

Yes

Hi, I am using the DJI OSMO+ gimbal for developing an Android Camera application and I noticed that there is a huge difference in CPU usage when using the official DJI Go app (CPU Usage ~10% to 15%) from the Android PlayStore vs. DJI FPV Demo app (CPU Usage ~40% to 50%). Here are some details re my development environment:

  1. Which DJI Product you are using? - DJI OSMO+
  2. Which DJI SDK you are using? - DJI Android Mobile SDK V4.4.1
  3. Which Android Device and Android System version you are using? - Device: Pixel XL; Android System: 7.1.2 (Android N)
  4. Which Android Studio version you are using? - Android Studio: 3.0.1; JRE: 1.8
  5. A short description of your problem includes debugging logs or screenshots. - I noticed that there is a huge difference in CPU usage when using the official DJI Go app (CPU Usage ~10% to 15%) from the Android PlayStore vs. DJI FPV Demo app (CPU Usage ~40% to 50%). I used the "adb shell top" command to profile CPU usage.

DJI FPV Demo: 6044 u0_a125 16 -4 51% S 151 1597524K 154936K ta com.dji.FPVDemo 6044 u0_a125 16 -4 40% S 154 1601524K 156208K ta com.dji.FPVDemo 6044 u0_a125 16 -4 43% S 157 1604996K 155932K ta com.dji.FPVDemo 6044 u0_a125 16 -4 43% S 159 1607068K 155640K ta com.dji.FPVDemo 6044 u0_a125 16 -4 49% R 163 1611676K 156136K ta com.dji.FPVDemo 6044 u0_a125 16 -4 44% S 166 1614516K 155000K ta com.dji.FPVDemo 6044 u0_a125 16 -4 43% S 167 1616440K 156840K ta com.dji.FPVDemo 6044 u0_a125 16 -4 40% S 170 1619948K 156568K ta com.dji.FPVDemo 6044 u0_a125 16 -4 43% S 173 1623292K 156680K ta com.dji.FPV

DemoDJI Go: 4009 u0_a158 16 -4 13% S 139 2261940K 223852K ta dji.pilot 4009 u0_a158 16 -4 13% S 136 2258952K 226304K ta dji.pilot 4009 u0_a158 16 -4 14% S 131 2253212K 227052K ta dji.pilot 4009 u0_a158 16 -4 14% S 130 2252356K 226992K ta dji.pilot 4009 u0_a158 16 -4 13% S 131 2253640K 223644K ta dji.pilot 4009 u0_a158 16 -4 14% S 128 2250664K 225868K ta dji.pilot 4009 u0_a158 16 -4 13% S 129 2251020K 226740K ta dji.pilot

Note that CPU usage stays ~30% even on the ConnectionActivity (i.e. before even starting the video decoding in the MainActivity). Seems like a whole lot of junk on my device hogging the CPU for no reason...

Questions: - Does anyone know what could be the reason behind this huge CPU usage difference? - Please advice on how I can reduce the CPU usage when using the DJI FPV Demo app; kindly share code snippet or update Github with sample code.

Thanks!