NULL pointer Exception in mfstream.cpp with QMediaPlayer and QTCPSocket



  • I try to implement a client for live stream video over TCP.

    To display the video I tried use the QMediaPlayer class (displaying video files works well). To recieve the videostream I use the QTCPSocket class.
    Connection to Server works well too. After establishing connection, the server started to stream - seems to work well too.
    On the client site (my QT client) i receive the connected signal.
    In the "connected" slot, I have the following code:

    if(m_client->m_socket->canReadLine())
    {
    player->setMedia(0, m_client->m_socket);
    player->play();
    }

    After "play()" I received an exception.

    Debugging showed me the following:
    In mfstream.cpp, the methods "BeginRead" was called - filled the member variable "m_currentReadResult".
    after some other method calls, "EndRead" was called - the variable m_currentReadResult was set to NULL again.
    A little bit later "bool QAbstractSocketPrivate::canReadNotification()" was called with "emit q->readyRead();"

    -> void MFStream::handleReadyRead()
    {
    doRead();
    }

    ->
    void MFStream::doRead()
    {
    bool readDone = true;
    IUnknown *pUnk = NULL;
    HRESULT hr = m_currentReadResult->GetObject(&pUnk);

    But now "m_currentReadResult is still "NULL" -> exception.

    I don't know if there is a bug in the QT library or is it not recommended to use a QTcpSocket object (= QIODevice) together with
    QMediaPlayer.

    *QMediaPlayer->setMedia(0, QTcpSocket)

    Can somebody help me?


Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.