Reputation: 77
I am trying to display more than one video in Qt (in one window) but I get data for each video from a unique socket in a thread as I know we cant access qt widget from another thread so I have to signal to the main thread that data is ready but this is a burden on the main thread, you can imagine 10 or more threads signaling to the main thread whenever a frame arrives, am I right to think this way if so, can you suggest a different approach ?
I have googled a lot and read about threading in Qt but I need someone to clear my doubts thank you.
Upvotes: 2
Views: 421
Reputation: 49279
Don't worry, signaling alone will not overburden the main thread's event loop, even if queued connections are significantly slower than direct connections, you can still have tens, possibly even hundreds per seconds without running into trouble.
Just make sure you are not using the connections to transfer the actual data. As your threads are in a single process, they share the same addressing space, so you can avoid slow data transfers altogether.
Now whether your main thread has enough processing power to display 10 video widgets is a whole different story.
Upvotes: 2