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

Android 4.3 Crash #1

Closed
silverscania opened this issue May 12, 2014 · 4 comments
Closed

Android 4.3 Crash #1

silverscania opened this issue May 12, 2014 · 4 comments

Comments

@silverscania
Copy link

Hey, just built the sample and it works really well streaming from a 4.4 device.
Viewing also works with 4.3. But when I go to capture on my 4.3 device I get a crash (io.kickflip.sdk.av.CameraEncoder.handleFrameAvailable(CameraEncoder.java:416)) . Its a Samsung GT-I9300. Log cat is below, hope it helps:

05-12 17:23:57.879: I/Muxer(11442): Created muxer for output: /storage/emulated/0/MySampleApp/480fc028-aa7f-42f4-b59e-551b828b9f20/index.m3u8
05-12 17:23:57.884: D/dalvikvm(11442): Trying to load lib /data/app-lib/io.kickflip.sample-1/libFFmpegWrapper.so 0x42791798
05-12 17:23:57.919: D/dalvikvm(11442): Added shared lib /data/app-lib/io.kickflip.sample-1/libFFmpegWrapper.so 0x42791798
05-12 17:23:57.919: D/dalvikvm(11442): No JNI_OnLoad found in /data/app-lib/io.kickflip.sample-1/libFFmpegWrapper.so 0x42791798, skipping init
05-12 17:23:58.339: I/Choreographer(11442): Skipped 31 frames! The application may be doing too much work on its main thread.
05-12 17:23:58.929: D/AbsListView(11442): unregisterIRListener() is called
05-12 17:23:58.974: I/dalvikvm(11442): Could not find method android.media.MediaCodec.setParameters, referenced from method io.kickflip.sdk.av.AndroidEncoder.adjustBitrate
05-12 17:23:58.974: W/dalvikvm(11442): VFY: unable to resolve virtual method 484: Landroid/media/MediaCodec;.setParameters (Landroid/os/Bundle;)V
05-12 17:23:58.974: D/dalvikvm(11442): VFY: replacing opcode 0x6e at 0x0016
05-12 17:23:58.984: I/OMXClient(11442): Using client-side OMX mux.
05-12 17:23:59.144: V/AudioRecord(11442): set(): sampleRate 44100, channelMask 0x10, frameCount 5120
05-12 17:23:59.144: V/AudioRecord(11442): set(): mSessionId 39
05-12 17:23:59.149: V/AudioRecord(11442): AudioRecord::set() minFrameCount = 2048
05-12 17:23:59.244: I/Broadcaster(11442): Initial video bitrate : 2000000
05-12 17:23:59.249: I/Broadcaster(11442): Got storage credentials io.kickflip.sdk.api.json.User@4293a350
05-12 17:23:59.374: D/dalvikvm(11442): GC_FOR_ALLOC freed 4473K, 30% free 15353K/21708K, paused 36ms, total 37ms
05-12 17:23:59.399: D/dalvikvm(11442): GC_FOR_ALLOC freed 10K, 27% free 15999K/21708K, paused 16ms, total 16ms
05-12 17:23:59.399: I/dalvikvm-heap(11442): Grow heap (frag case) to 19.363MB for 2688016-byte allocation
05-12 17:23:59.419: D/dalvikvm(11442): GC_FOR_ALLOC freed 0K, 15% free 18624K/21708K, paused 17ms, total 17ms
05-12 17:23:59.439: W/CameraRelease(11442): Didn't try to open camera onHAResume. rec: false mSurfaceTexture ready? no
05-12 17:23:59.469: D/SensorManager(11442): registerListener :: create queue :: handler = 0, name = LSM330DLC 3-axis Accelerometer, delay = 200000,
05-12 17:23:59.474: I/Choreographer(11442): Skipped 32 frames! The application may be doing too much work on its main thread.
05-12 17:23:59.794: D/CameraSurfaceRenderer(11442): onSurfaceCreated
05-12 17:23:59.824: D/Texture2dProgram(11442): Created program 3 (TEXTURE_EXT)
05-12 17:23:59.829: D/CameraSurfaceRenderer(11442): onSurfaceChanged 1280x720
05-12 17:23:59.829: I/CameraSurfaceRenderer(11442): setTexSize on display Texture
05-12 17:23:59.844: I/OMXClient(11442): Using client-side OMX mux.
05-12 17:23:59.859: I/ACodec(11442): setupVideoEncoder succeeded
05-12 17:23:59.879: D/EglCore(11442): EGLContext created, client version 2
05-12 17:24:00.064: D/Texture2dProgram(11442): Created program 6 (TEXTURE_EXT)
05-12 17:24:00.099: D/AbsListView(11442): onVisibilityChanged() is called, visibility : 4
05-12 17:24:00.099: D/AbsListView(11442): unregisterIRListener() is called
05-12 17:24:01.129: E/GLConsumer(11442): [unnamed-11442-0] syncForReleaseLocked: error dup'ing native fence fd: 0x3000
05-12 17:24:01.129: W/dalvikvm(11442): threadid=11: thread exiting with uncaught exception (group=0x41d2e700)
05-12 17:24:01.134: E/AndroidRuntime(11442): FATAL EXCEPTION: CameraEncoder
05-12 17:24:01.134: E/AndroidRuntime(11442): java.lang.RuntimeException: Error during updateTexImage (see logcat for details)
05-12 17:24:01.134: E/AndroidRuntime(11442): at android.graphics.SurfaceTexture.nativeUpdateTexImage(Native Method)
05-12 17:24:01.134: E/AndroidRuntime(11442): at android.graphics.SurfaceTexture.updateTexImage(SurfaceTexture.java:163)
05-12 17:24:01.134: E/AndroidRuntime(11442): at io.kickflip.sdk.av.CameraEncoder.handleFrameAvailable(CameraEncoder.java:416)
05-12 17:24:01.134: E/AndroidRuntime(11442): at io.kickflip.sdk.av.CameraEncoder.access$200(CameraEncoder.java:27)
05-12 17:24:01.134: E/AndroidRuntime(11442): at io.kickflip.sdk.av.CameraEncoder$EncoderHandler.handleMessage(CameraEncoder.java:826)
05-12 17:24:01.134: E/AndroidRuntime(11442): at android.os.Handler.dispatchMessage(Handler.java:99)
05-12 17:24:01.134: E/AndroidRuntime(11442): at android.os.Looper.loop(Looper.java:176)
05-12 17:24:01.134: E/AndroidRuntime(11442): at io.kickflip.sdk.av.CameraEncoder.run(CameraEncoder.java:597)
05-12 17:24:01.134: E/AndroidRuntime(11442): at java.lang.Thread.run(Thread.java:841)
05-12 17:24:01.359: D/SensorManager(11442): unregisterListener ::
05-12 17:24:10.064: I/Choreographer(11442): Skipped 521 frames! The application may be doing too much work on its main thread.

@OnlyInAmerica
Copy link
Member

Thanks for reporting! I'm looking into this now.

Note to self: Double check all the synchronization in CameraEncoder.

@silverscania
Copy link
Author

Just tried this fix and it seems that that was all that was needed to fix the crash on my 4.3 samsung. Although the framerate seems slow when streaming the stream can be viewed on another device.
The changes don't affect my 4.4 devices and these continue to work.

@uberspot
Copy link

I confirm that this fixed a crash on Nexus 7 with android 4.3 as well. :) 👍

@OnlyInAmerica
Copy link
Member

Thank you @silverscania! Sure enough, the wisdom of your fix is right there in the Android docs

updateTexImage() may only be called on the thread with the OpenGL ES context that contains the texture object.

The SurfaceTexture's EGL context is created on the CameraSurface.Renderer thread, so this is definitely the way to go.

👍 indeed!

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

3 participants