Peter-St / Android-UVC-Camera

GNU Lesser General Public License v2.1
136 stars 25 forks source link

Android 13+ UVYV Stream failed; Result = -1 #36

Closed nsknyc closed 8 months ago

nsknyc commented 8 months ago

Hello again Peter, Long time. I somewhat recently purchased a device running android 13, and would love to get this app running again but on it. As opposed to me using my drone controller like I mentioned before (closed issue #18). I notice the tons of changes and improvements you've done (Congrats!) I decided to see if I can get this running on 13>, and so far so good. I have the permissions working properly. The thing is I've ran into a bit of a snag. I get this "error" (Stream failed; Result = -1), but it seems that its just a harmless unskippable condition.

This is under the isoStream function in StartIsoStreamActivityUvc.java under else if (videoformat.equals("UYVY")) test. log("Start the stream .."); int result = -1; //result = JNA_I_LibUsb.INSTANCE.JniStreamOverSurfaceUVC(new Pointer(mNativePtr)); if (result == 0) { ((Button) findViewById(R.id.startStream)).setEnabled(false); stopStreamButton.getBackground().setAlpha(180); // 25% transparent stopStreamButton.setEnabled(true); startStream.getBackground().setAlpha(20); // 95% transparent photoButton.setEnabled(true); photoButton.setBackgroundResource(R.drawable.bg_button_bildaufnahme); videoButton.setEnabled(true); videoButton.setAlpha(1); // 100% transparent stopKamera = false; } else { displayMessage("Stream failed; Result = " + result); log ("Stream failed; Result = " + result); } Here's the deal ignoring the message, no video is produced. While debugging I can see that the application can see the USB device along with the vendor ID etc. Since the rework, is this part still under development? I could upload the changes to my cloned repo, but the code will definitely leave out anyone running Android less than 13. Basically it was a quick hack to get it running with proper permission requests. I can fix this later so it doesn't leave out other users.

---- edit ---- Basically, I'd like to know if its not currently working and I'm chasing a wild goose. Or it should work, and it something that I need to fix to get working for android 13+

nsknyc commented 8 months ago

Ok, I went back to my android 7 device. And the thermal works flawlessly with this version of the app. I very likely need to clean up the code a bit to get it working on 13. I'll upload the updated code once I can confirm it works with 13+ as well as legacy devices.

---- edit ---- Works perfectly on Android 13+. Will test on Android 7. Also, please ignore the comment about "Result = -1" harmless and unskippable. I was looking at the code without trying to execute it, and just assumed due to bad settings. That condition is never triggered if the camera is found and loaded. My apologies.

My goal is now to correct the methods I touched to get it working on 13. I'll set the proper test for anything under Tiramisu. Afterwards I'll send a pull.