qzxing
qzxing copied to clipboard
Crash of QZXingLive with Qt 6.2.3 on Android 12
I am currently porting my app to Qt 6.2.x from Qt 5.15.x. QZXing is a part of our application so I was really thankful, that already some effort was made to get QZXing compatible with Qt6. When trying out with QZXingLive on my Android 12 device the example started but it crashes after a few seconds. I have a detailed crashlog of QtCreator:
I project.exampl: Late-enabling -Xcheck:jni
D ProcessState: Binder ioctl to enable oneway spam detection failed: Invalid argument
D CompatibilityChangeReporter: Compat change id reported: 171979766; UID 10381; state: DISABLED
V GraphicsEnvironment: ANGLE Developer option for 'org.qtproject.example' set to: 'default'
V GraphicsEnvironment: ANGLE GameManagerService for org.qtproject.example: false
V GraphicsEnvironment: Updatable production driver is not supported on the device.
D NetworkSecurityConfig: No Network Security Config specified, using platform default
D NetworkSecurityConfig: No Network Security Config specified, using platform default
W System : ClassLoader referenced unknown path:
D Qt JAVA : Class org.qtproject.qt.android.multimedia.QtAudioDeviceManager does not implement setActivity method
I QtCore : Start
I Qt : qt started
I AdrenoGLES-0: QUALCOMM build : 85da404, I46ff5fc46f
I AdrenoGLES-0: Build Date : 11/30/20
I AdrenoGLES-0: OpenGL ES Shader Compiler Version: EV031.31.04.01
I AdrenoGLES-0: Local Branch : promo490_3_Google
I AdrenoGLES-0: Remote Branch :
I AdrenoGLES-0: Remote Branch :
I AdrenoGLES-0: Reconstruct Branch :
I AdrenoGLES-0: Build Config : S P 10.0.4 AArch32
I AdrenoGLES-0: Driver Path : /vendor/lib/egl/libGLESv2_adreno.so
D hw-ProcessState: Binder ioctl to enable oneway spam detection failed: Invalid argument
I AdrenoGLES-0: PFP: 0x016ee190, ME: 0x00000000
W AdrenoUtils: <ReadGpuID_from_sysfs:197>: Failed to open /sys/class/kgsl/kgsl-3d0/gpu_model
W AdrenoUtils: <ReadGpuID:221>: Failed to read chip ID from gpu_model. Fallback to use the GSL path
D hw-ProcessState: Binder ioctl to enable oneway spam detection failed: Invalid argument
D libQZXingLive_armeabi-v7a.so: About to request permissions
W libQZXingLive_armeabi-v7a.so: QQmlEngine::setContextForObject(): Object already has a QQmlContext
D libQZXingLive_armeabi-v7a.so: Permissions granted
W System.err: java.lang.RuntimeException: setParameters failed
W System.err: at android.hardware.Camera.native_setParameters(Native Method)
W System.err: at android.hardware.Camera.setParameters(Camera.java:2061)
W System.err: java.lang.IllegalArgumentException: Invalid pixel_format=7667809
W System.err: at android.hardware.Camera$Parameters.setPreviewFormat(Camera.java:3140)
W System.err: java.lang.RuntimeException: setParameters failed
W System.err: at android.hardware.Camera.native_setParameters(Native Method)
W System.err: at android.hardware.Camera.setParameters(Camera.java:2061)
W System.err: java.lang.RuntimeException: setParameters failed
W System.err: at android.hardware.Camera.native_setParameters(Native Method)
W System.err: at android.hardware.Camera.setParameters(Camera.java:2061)
W System.err: java.lang.IllegalArgumentException: Invalid pixel_format=7667809
W System.err: at android.hardware.Camera$Parameters.setPreviewFormat(Camera.java:3140)
W System.err: java.lang.RuntimeException: setParameters failed
W System.err: at android.hardware.Camera.native_setParameters(Native Method)
W System.err: at android.hardware.Camera.setParameters(Camera.java:2061)
W System.err: java.lang.RuntimeException: setParameters failed
W System.err: at android.hardware.Camera.native_setParameters(Native Method)
W System.err: at android.hardware.Camera.setParameters(Camera.java:2061)
W System.err: java.lang.IllegalArgumentException: Invalid pixel_format=7667809
W System.err: at android.hardware.Camera$Parameters.setPreviewFormat(Camera.java:3140)
W System.err: java.lang.RuntimeException: setParameters failed
W System.err: at android.hardware.Camera.native_setParameters(Native Method)
W System.err: at android.hardware.Camera.setParameters(Camera.java:2061)
W project.exampl: [SurfaceTexture-0-10119-0] bindTextureImage: clearing GL error: 0x500
W libQZXingLive_armeabi-v7a.so: QImage QVideoFrame::toImage() const : unsupported pixel format Format_SamplerExternalOES
D libQZXingLive_armeabi-v7a.so: QZXingFilter error: Cant create image file to process.
E project.exampl: [SurfaceTexture-0-10119-0] checkAndUpdateEglState: invalid current EGLContext
W System.err: java.lang.IllegalStateException: Unable to update texture contents (see logcat for details)
W System.err: at android.graphics.SurfaceTexture.nativeUpdateTexImage(Native Method)
W System.err: at android.graphics.SurfaceTexture.updateTexImage(SurfaceTexture.java:249)
E BufferQueueProducer: [SurfaceView[org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity]#1(BLAST Consumer)1](id:278700000001,api:0,p:-1,c:10119) query: BufferQueue has been abandoned
E BufferQueueProducer: [SurfaceView[org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity]#1(BLAST Consumer)1](id:278700000001,api:0,p:-1,c:10119) dequeueBuffer: BufferQueue has been abandoned
I Adreno : DequeueBuffer: dequeueBuffer failed
E BufferQueueProducer: [SurfaceView[org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity]#1(BLAST Consumer)1](id:278700000001,api:0,p:-1,c:10119) query: BufferQueue has been abandoned
E BufferQueueProducer: [SurfaceView[org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity]#1(BLAST Consumer)1](id:278700000001,api:0,p:-1,c:10119) dequeueBuffer: BufferQueue has been abandoned
I Adreno : DequeueBuffer: dequeueBuffer failed
W libQZXingLive_armeabi-v7a.so: QEGLPlatformContext: eglSwapBuffers failed: 300d
E BufferQueueProducer: [SurfaceView[org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity]#1(BLAST Consumer)1](id:278700000001,api:0,p:-1,c:10119) query: BufferQueue has been abandoned
E BufferQueueProducer: [SurfaceView[org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity]#1(BLAST Consumer)1](id:278700000001,api:0,p:-1,c:10119) dequeueBuffer: BufferQueue has been abandoned
I Adreno : DequeueBuffer: dequeueBuffer failed
E BufferQueueProducer: [SurfaceView[org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity]#1(BLAST Consumer)1](id:278700000001,api:0,p:-1,c:10119) query: BufferQueue has been abandoned
E BufferQueueProducer: [SurfaceView[org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity]#1(BLAST Consumer)1](id:278700000001,api:0,p:-1,c:10119) dequeueBuffer: BufferQueue has been abandoned
I Adreno : DequeueBuffer: dequeueBuffer failed
W libQZXingLive_armeabi-v7a.so: QEGLPlatformContext: eglSwapBuffers failed: 300d
E BufferQueueProducer: [SurfaceView[org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity]#1(BLAST Consumer)1](id:278700000001,api:0,p:-1,c:10119) query: BufferQueue has been abandoned
E BufferQueueProducer: [SurfaceView[org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity]#1(BLAST Consumer)1](id:278700000001,api:0,p:-1,c:10119) dequeueBuffer: BufferQueue has been abandoned
I Adreno : DequeueBuffer: dequeueBuffer failed
E BufferQueueProducer: [SurfaceView[org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity]#1(BLAST Consumer)1](id:278700000001,api:0,p:-1,c:10119) query: BufferQueue has been abandoned
E BufferQueueProducer: [SurfaceView[org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity]#1(BLAST Consumer)1](id:278700000001,api:0,p:-1,c:10119) dequeueBuffer: BufferQueue has been abandoned
I Adreno : DequeueBuffer: dequeueBuffer failed
W libQZXingLive_armeabi-v7a.so: QEGLPlatformContext: eglSwapBuffers failed: 300d
W System.err: java.lang.RuntimeException: setParameters failed
W System.err: at android.hardware.Camera.native_setParameters(Native Method)
W System.err: at android.hardware.Camera.setParameters(Camera.java:2061)
W System.err: java.lang.IllegalArgumentException: Invalid pixel_format=7667809
W System.err: at android.hardware.Camera$Parameters.setPreviewFormat(Camera.java:3140)
W System.err: java.lang.RuntimeException: setParameters failed
W System.err: at android.hardware.Camera.native_setParameters(Native Method)
W System.err: at android.hardware.Camera.setParameters(Camera.java:2061)
E Camera : Error 1
And I can also provide the Logcat output:
03-18 07:31:04.858 1880 3162 I ActivityTaskManager: START u0 {act=android.intent.action.MAIN cat=[android.intent.category.LAUNCHER] flg=0x10200000 cmp=org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity bnds=[37,1591][238,1915]} from uid 10157
03-18 07:31:04.877 1880 1964 I ActivityManager: Start proc 9284:org.qtproject.example/u0a381 for pre-top-activity {org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity}
03-18 07:31:04.963 9284 9284 V GraphicsEnvironment: ANGLE Developer option for 'org.qtproject.example' set to: 'default'
03-18 07:31:04.964 9284 9284 V GraphicsEnvironment: ANGLE GameManagerService for org.qtproject.example: false
03-18 07:31:05.155 1880 1947 I ActivityTaskManager: Displayed org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity: +295ms
03-18 07:31:05.167 16980 16980 I GoogleInputMethodService: GoogleInputMethodService.onStartInput():1907 onStartInput(EditorInfo{inputType=0x0(NULL) imeOptions=0x0 privateImeOptions=null actionName=UNSPECIFIED actionLabel=null actionId=0 initialSelStart=-1 initialSelEnd=-1 initialCapsMode=0x0 hintText=null label=null packageName=org.qtproject.example fieldId=-1 fieldName=null extras=null}, false)
03-18 07:31:05.243 1406 14814 I CameraService: CameraService::connect call (PID -1 "org.qtproject.example", camera ID 0) and Camera API version 1
03-18 07:31:05.243 1406 14814 I Camera2ClientBase: Camera 0: Opened. Client: org.qtproject.example (PID 9284, UID 10381)
03-18 07:31:05.280 1406 14814 I Camera2ClientBase: Closed Camera 0. Client was: org.qtproject.example (PID 9284, UID 10381)
03-18 07:31:05.282 1406 14814 I CameraService: CameraService::connect call (PID -1 "org.qtproject.example", camera ID 1) and Camera API version 1
03-18 07:31:05.283 1406 14814 I Camera2ClientBase: Camera 1: Opened. Client: org.qtproject.example (PID 9284, UID 10381)
03-18 07:31:05.305 1406 14814 I Camera2ClientBase: Closed Camera 1. Client was: org.qtproject.example (PID 9284, UID 10381)
03-18 07:31:05.412 1406 14814 I CameraService: CameraService::connect call (PID -1 "org.qtproject.example", camera ID 0) and Camera API version 1
03-18 07:31:05.412 1406 14814 I Camera2ClientBase: Camera 0: Opened. Client: org.qtproject.example (PID 9284, UID 10381)
03-18 07:31:05.530 1880 2638 W InputManager-JNI: Input channel object 'faf7bcc Splash Screen org.qtproject.example (client)' was disposed without first being removed with the input manager!
03-18 07:31:10.294 9405 9405 F DEBUG : Cmdline: org.qtproject.example
03-18 07:31:10.294 9405 9405 F DEBUG : pid: 9284, tid: 9336, name: QtThread >>> org.qtproject.example <<<
03-18 07:31:10.294 9405 9405 F DEBUG : #01 pc 001aa2a9 /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Gui_armeabi-v7a.so (QImage::copy(QRect const&) const+592) (BuildId: 3f74710dd8871fddf709169b53b68028d040cb87)
03-18 07:31:10.294 9405 9405 F DEBUG : #02 pc 001aa595 /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Gui_armeabi-v7a.so (QImage::detach()+84) (BuildId: 3f74710dd8871fddf709169b53b68028d040cb87)
03-18 07:31:10.294 9405 9405 F DEBUG : #03 pc 001aa673 /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Gui_armeabi-v7a.so (QImage::bits()+12) (BuildId: 3f74710dd8871fddf709169b53b68028d040cb87)
03-18 07:31:10.294 9405 9405 F DEBUG : #04 pc 0008464d /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Multimedia_armeabi-v7a.so (BuildId: 4d8fdf71f537f8f79755b560ef4e79e703aa1fbb)
03-18 07:31:10.294 9405 9405 F DEBUG : #05 pc 00077e43 /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Multimedia_armeabi-v7a.so (QVideoFrame::map(QVideoFrame::MapMode)+102) (BuildId: 4d8fdf71f537f8f79755b560ef4e79e703aa1fbb)
03-18 07:31:10.294 9405 9405 F DEBUG : #06 pc 00079b65 /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Multimedia_armeabi-v7a.so (QVideoTextureHelper::updateRhiTextures(QVideoFrame, QRhi*, QRhiResourceUpdateBatch*, QRhiTexture**)+336) (BuildId: 4d8fdf71f537f8f79755b560ef4e79e703aa1fbb)
03-18 07:31:10.294 9405 9405 F DEBUG : #07 pc 00011489 /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6MultimediaQuick_armeabi-v7a.so (BuildId: 8a5ce8c911f15798d9e14fa96973db6cc067eb20)
03-18 07:31:10.294 9405 9405 F DEBUG : #08 pc 00011517 /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6MultimediaQuick_armeabi-v7a.so (BuildId: 8a5ce8c911f15798d9e14fa96973db6cc067eb20)
03-18 07:31:10.294 9405 9405 F DEBUG : #09 pc 0023b2d3 /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Quick_armeabi-v7a.so (QSGBatchRenderer::Renderer::updateMaterialDynamicData(QSGBatchRenderer::ShaderManagerShader*, QSGMaterialShader::RenderState&, QSGMaterial*, QSGBatchRenderer::Batch const*, QSGBatchRenderer::Element*, int, int)+102) (BuildId: 9aed5e180a051c4a63f7ecd5931bfebd2ce5809c)
03-18 07:31:10.294 9405 9405 F DEBUG : #10 pc 0023ba77 /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Quick_armeabi-v7a.so (QSGBatchRenderer::Renderer::prepareRenderMergedBatch(QSGBatchRenderer::Batch*, QSGBatchRenderer::Renderer::PreparedRenderBatch*)+482) (BuildId: 9aed5e180a051c4a63f7ecd5931bfebd2ce5809c)
03-18 07:31:10.294 9405 9405 F DEBUG : #11 pc 0023cd6b /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Quick_armeabi-v7a.so (QSGBatchRenderer::Renderer::prepareRenderPass(QSGBatchRenderer::Renderer::RenderPassContext*)+1102) (BuildId: 9aed5e180a051c4a63f7ecd5931bfebd2ce5809c)
03-18 07:31:10.294 9405 9405 F DEBUG : #12 pc 0023c8fd /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Quick_armeabi-v7a.so (QSGBatchRenderer::Renderer::render()+20) (BuildId: 9aed5e180a051c4a63f7ecd5931bfebd2ce5809c)
03-18 07:31:10.294 9405 9405 F DEBUG : #13 pc 00249fc9 /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Quick_armeabi-v7a.so (QSGRenderer::renderScene()+112) (BuildId: 9aed5e180a051c4a63f7ecd5931bfebd2ce5809c)
03-18 07:31:10.294 9405 9405 F DEBUG : #14 pc 0021e317 /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Quick_armeabi-v7a.so (QQuickWindowPrivate::renderSceneGraph(QSize const&, QSize const&)+610) (BuildId: 9aed5e180a051c4a63f7ecd5931bfebd2ce5809c)
03-18 07:31:10.294 9405 9405 F DEBUG : #15 pc 002fc1cd /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Quick_armeabi-v7a.so (BuildId: 9aed5e180a051c4a63f7ecd5931bfebd2ce5809c)
03-18 07:31:10.294 9405 9405 F DEBUG : #16 pc 002fc9a5 /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Quick_armeabi-v7a.so (BuildId: 9aed5e180a051c4a63f7ecd5931bfebd2ce5809c)
03-18 07:31:10.294 9405 9405 F DEBUG : #17 pc 002f257b /data/app/~~GvTTeqt9ZIUjapOF6eqf5Q==/org.qtproject.example-TxMcyNrYreWh5lnrkTl2Sg==/lib/arm/libQt6Core_armeabi-v7a.so (BuildId: 74cc796f0a1f7f16378bf23d59543c247767bde8)
03-18 07:31:10.312 1880 9411 W ActivityTaskManager: Force finishing activity org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity
03-18 07:31:10.368 1880 7034 I ActivityManager: Process org.qtproject.example (pid 9284) has died: fg TOP
03-18 07:31:10.369 1880 3254 I WindowManager: WIN DEATH: Window{4b32601 u0 org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity}
03-18 07:31:10.369 1880 3254 W InputManager-JNI: Input channel object '4b32601 org.qtproject.example/org.qtproject.qt.android.bindings.QtActivity (client)' was disposed without first being removed with the input manager!
03-18 07:31:10.671 1406 32202 I Camera2ClientBase: Closed Camera 0. Client was: org.qtproject.example (PID 9284, UID 10381)
Can anyone help me to narrow down, what I can do to get QZXing up and running?
I narrowed things down and it seems that
if (captureRect.isValid() && frameToProcess.size() != rect.size()) {
frameToProcess = image.copy(rect);
}
in QZxingFilterVideoSink.cpp is causing this crash. When i comment this line out, the app is not crashing. The example therefore does not recognize a barcode.
After further testing with Qt 6.3 RC1 after suggestion from Qt support I have narrowed things a little more down. I've done a manual slowdown of the processing by adding a timer which sets a bool each second to true to allow processing of videoFrame:
void QZXingFilter::processFrame(const QVideoFrame &frame) {
if(allowProcessing)
allowProcessing = false;
else
return;
#ifdef Q_OS_ANDROID
m_videoSink->setRhi(nullptr); // https://bugreports.qt.io/browse/QTBUG-97789
QVideoFrame f(frame);
f.map(QVideoFrame::ReadOnly);
#else
const QVideoFrame &f = frame;
#endif // Q_OS_ANDROID
if(!isDecoding() && processThread.isFinished()){
QImage::Format image_format = QVideoFrameFormat::imageFormatFromPixelFormat(f.pixelFormat());
if(image_format == QImage::Format_Invalid){
qDebug() << image_format;
#ifdef Q_OS_ANDROID
if(f.isMapped())
f.unmap();
#endif
return;
}
When i comment m_videoSink->setRhi(nullptr); out I get invalid image format from the frame. And when I comment this line in the app crashes with the crashlog attached. Seems that there is a problem in getting correct image information from VideoFrame QZXingLive_crashlog_QT6.3.0RC1.txt .
See this implementation: https://bugreports.qt.io/browse/QTBUG-97789?focusedCommentId=662706&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-662706
I tryed qzxing using qt 6.3 and didn't worked smooth (after 2-3 seconds there was only 1 frame in 5 seconds. This implementatoin fixed the issue on my side.
Implementend on my side here: https://github.com/CMGeorge/qzxing/commit/10b917f071b1f5b0145f04bb10ec8404d314165e#diff-cccfcad0b6ba438f5e4e6219f041e86fa651ea64921b2ba25ed5703af20c879f (Thre is a mess because of auto formating... only void QZXingFilter::processFrame(const QVideoFrame &frame) should be change. and don't forget to set signals as dirrect connection like here:
connect(m_videoSink, &QVideoSink::videoFrameChanged, this, &QZXingFilter::processFrame,Qt::DirectConnection);
Currently testing with Qt 6.5.0 and followed again the suggestions made in this thread. With master version the QZXing QrCode recognition is very slow and sluggish using QZXingLive. I've made following changes ot QZXingFilterVideoSink.cpp and with those changes QrCode-Scanning is working okay. https://gist.github.com/MichaelHeiser/5ab6ca42444a4c231ce0910ad0a4cf8a
@MichaelHeiser do you ever get it working with Qt 6.2? Current QXZing master is always crashing Android application when executing QImage().copy.
I also tried the Qt6_2_multimedia branch but it does crash also.
Currently working woth Qt 6.5.x. No changes to current version has to be made. QR-Code recognition is working as expected.