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. QMediaPlayer in multithreading env (5.10 CE)
Forum Updated to NodeBB v4.3 + New Features

QMediaPlayer in multithreading env (5.10 CE)

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 448 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.
  • Stanislav SilnickiS Offline
    Stanislav SilnickiS Offline
    Stanislav Silnicki
    wrote on last edited by
    #1

    Hi All!

    I'm implementing a media (video) player for multi-screen environment. Simultaneous start, etc...

    So, I instantiate several threads (Player class: public QThread). In each thread in its run() I create a new QMediaPlayer with nullptr as it's parent QObject. So I assume, that the object exists only in a new thread as soon as it is instantiated within a new thread inside run() func. and has no connection with othre threads ( I know, that QThread obejct itself resides in parent's thread, etc.).
    When the first thread (Player) for the first screen is created, nothing interesting is happening. But when exactly same second thread hits CPU, this strange warning appears in error stream:

    QObject: Cannot create children for a parent that is in a different thread.
    (Parent is QObject(0x7fd9ba6d9f20), parent's thread is Player(0x55bc41591c20), current thread is Player(0x55bc41608b20)
    

    Indeed, its only a warning, that doesn't break the functionality, so both players work fine and both screens show proper content.

    But what is the nature of this warning? Looks like both instances of QMediaPlayer somehow interferes?

    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