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

[Qt5] HControlPoint : Application stucked when discovering devices with some Qt5 versions (FUTEX_WAIT) #4

Open
ThomArmax opened this issue Oct 17, 2015 · 1 comment
Assignees
Labels

Comments

@ThomArmax
Copy link
Owner

strace give the following log :

futex(0x9cb120, FUTEX_WAIT, 2, NULL

With my system default Qt version (5.4.1) I have no issue, but with Qt 5.4.3 for Raspberry PI (built with Yocto), the application seems to be blocked after having discovering one UPnP device.

The code I use to produce this issue :

#include <QCoreApplication>
#include <QDebug>
#include <HUpnpCore/HControlPoint>
#include <HUpnpCore/HControlPointConfiguration>
#include <HUpnpCore/HDeviceInfo>
#include <HUpnpCore/HClientService>
#include <HUpnpCore/HServiceInfo>
#include <HUpnpCore/HServiceId>
#include <HUpnpAv/HMediaBrowser>

using namespace Herqq::Upnp;
using namespace Herqq::Upnp::Av;

class Browser :public QObject {
    Q_OBJECT
public:
    Browser(QObject * parent = 0) : QObject(parent), browser(new HMediaBrowser(this)) {
        connect(browser,
                SIGNAL(objectsBrowsed(Herqq::Upnp::Av::HMediaBrowser*,QSet<QString>)),
                this,
                SLOT(onObjectsBrowsed(Herqq::Upnp::Av::HMediaBrowser*,QSet<QString>)));
        connect(browser,
                SIGNAL(browseComplete(Herqq::Upnp::Av::HMediaBrowser*)),
                this,
                SLOT(onBrowseComplete(Herqq::Upnp::Av::HMediaBrowser*)));
        connect(browser,
                SIGNAL(browseFailed(Herqq::Upnp::Av::HMediaBrowser*)),
                this,
                SLOT(onBrowseFailed(Herqq::Upnp::Av::HMediaBrowser*)));
    }
public slots:
    void browseDevice(Herqq::Upnp::HClientDevice* device) {
        qDebug() << Q_FUNC_INFO << "Device" << device->info().friendlyName();
        HClientServices servs = device->services();
        HClientService * cds = NULL;
        foreach(HClientService* serv, servs) {
            qDebug() << "     " << serv->info().serviceId().toString();
            if(QString::compare(serv->info().serviceId().toString(),
                                "urn:upnp-org:serviceId:ContentDirectory") == 0)
                cds = serv;
        }
        if (cds) {
            browser->reset(cds);
            browser->browseRoot();
        }
        else {
            qDebug() << "No Content Directory Service in" << device->info().friendlyName();
        }
    }

private slots:
    void onObjectsBrowsed(Herqq::Upnp::Av::HMediaBrowser*,QSet<QString>) {
        qDebug() << Q_FUNC_INFO;
    }

    void onBrowseFailed (Herqq::Upnp::Av::HMediaBrowser *) {
        qDebug() << Q_FUNC_INFO;
    }

    void onBrowseComplete (Herqq::Upnp::Av::HMediaBrowser *) {
        qDebug() << Q_FUNC_INFO;
    }

private:
    HMediaBrowser * browser;
};

int main(int argc, char *argv[])
{
    QCoreApplication a(argc, argv);

    HControlPointConfiguration ctrPtConf;
    HControlPoint ctrPt(ctrPtConf);
    Browser browser;

    QObject::connect(&ctrPt,
                     SIGNAL(rootDeviceOnline(Herqq::Upnp::HClientDevice*)),
                     &browser,
                     SLOT(browseDevice(Herqq::Upnp::HClientDevice*))
                     );

    ctrPt.init();

    return a.exec();
}

#include "main.moc"
@ThomArmax ThomArmax added the bug label Oct 17, 2015
@ThomArmax ThomArmax self-assigned this Oct 17, 2015
@ThomArmax ThomArmax changed the title [Qt5] HMediaBrowser : Application stucked when browsing content directory service (FUTEX_WAIT) [Qt5] HControlPoint : Application stucked when discovering devices with some Qt5 versions (FUTEX_WAIT) Oct 18, 2015
@ThomArmax
Copy link
Owner Author

Actually, it's not a HUPnP issue.
It is a Qt configuration issue.
It seems that when Qt is not compiled with glib, this issue occur, but not when Qt is built against glib

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

No branches or pull requests

1 participant