Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. NULL pointer Exception in mfstream.cpp with QMediaPlayer and QTCPSocket
Qt 6.11 is out! See what's new in the release blog

NULL pointer Exception in mfstream.cpp with QMediaPlayer and QTCPSocket

Scheduled Pinned Locked Moved General and Desktop
1 Posts 1 Posters 774 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • B Offline
    B Offline
    BERGLE
    wrote on last edited by
    #1

    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?

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved