Giter Club home page Giter Club logo

Comments (6)

MichaelHeiser avatar MichaelHeiser commented on June 2, 2024

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.

from qzxing.

MichaelHeiser avatar MichaelHeiser commented on June 2, 2024

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
.

from qzxing.

CMGeorge avatar CMGeorge commented on June 2, 2024

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: CMGeorge@10b917f#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);

from qzxing.

MichaelHeiser avatar MichaelHeiser commented on June 2, 2024

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

from qzxing.

sk2212 avatar sk2212 commented on June 2, 2024

@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.

from qzxing.

MichaelHeiser avatar MichaelHeiser commented on June 2, 2024

Currently working woth Qt 6.5.x. No changes to current version has to be made. QR-Code recognition is working as expected.

from qzxing.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.