Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Race condition in example OGVideoProcDroid #2

Open
ruslo opened this issue Oct 2, 2015 · 0 comments
Open

Race condition in example OGVideoProcDroid #2

ruslo opened this issue Oct 2, 2015 · 0 comments

Comments

@ruslo
Copy link

ruslo commented Oct 2, 2015

Two threads can simultaneously read/modify imgData variable. This may lead to synchronization errors. I can reproduce such error by adding delay to the update method: https://github.com/ruslo/ogles_gpgpu/commit/efed7c73d234f2814092e34e478d270a40b7c36f

logcat:

I/CamActivity(22340): zeroerror
D/AndroidRuntime(22340): Shutting down VM
W/dalvikvm(22340): threadid=1: thread exiting with uncaught exception (group=0x41620d58)
E/mm-camera(  272): invalid stats mask. Return back
E/AndroidRuntime(22340): FATAL EXCEPTION: main
E/AndroidRuntime(22340): Process: ogles_gpgpu.examples.ogvideoprocdroid, PID: 22340
E/AndroidRuntime(22340): java.lang.NullPointerException
E/AndroidRuntime(22340):    at ogles_gpgpu.examples.ogvideoprocdroid.CamActivity$CPUImgProcThread.update(CamActivity.java:595)
E/AndroidRuntime(22340):    at ogles_gpgpu.examples.ogvideoprocdroid.CamActivity.onFrameAvailable(CamActivity.java:305)
E/AndroidRuntime(22340):    at android.graphics.SurfaceTexture$EventHandler.handleMessage(SurfaceTexture.java:296)
E/AndroidRuntime(22340):    at android.os.Handler.dispatchMessage(Handler.java:102)
E/AndroidRuntime(22340):    at android.os.Looper.loop(Looper.java:136)
E/AndroidRuntime(22340):    at android.app.ActivityThread.main(ActivityThread.java:5095)
E/AndroidRuntime(22340):    at java.lang.reflect.Method.invokeNative(Native Method)
E/AndroidRuntime(22340):    at java.lang.reflect.Method.invoke(Method.java:515)
E/AndroidRuntime(22340):    at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:786)
E/AndroidRuntime(22340):    at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:602)
E/AndroidRuntime(22340):    at dalvik.system.NativeStart.main(Native Method)

Error doesn't occurs after synchronization code added: https://github.com/ruslo/ogles_gpgpu/commit/28e45d17cabce711ed461aa77b375af8e064ca6c (fix will look different after this change).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant