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. Camera stopped streaming when app window lose focus
Forum Updated to NodeBB v4.3 + New Features

Camera stopped streaming when app window lose focus

Scheduled Pinned Locked Moved Solved General and Desktop
4 Posts 2 Posters 270 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.
  • T Offline
    T Offline
    tommytrojan
    wrote on last edited by
    #1

    Hi,
    I'm using Qt 6.3.1 on Windows and Linux. This problem only happens on Windows. I'm using QVideoSink and its videoFrameChanged signal to stream camera data. I just found out that two things happen when the app window just lose focus (when I click on other app)

    1. Memory consumption of the app goes up quickly
    2. The app does not show new camera frames. It seems like the videoFrameChanged signal is not there.

    After a while, the app resumes streaming. Then if I click on the app again to focus on it, the app freezes for about a second, then resumes streaming.

    Why switching focus on and off causes the app to freeze? Is this a Windows problem? I'm using company laptop with quite a bit of security software installed, can it be an issue?

    Thank you!

    1 Reply Last reply
    0
    • T Offline
      T Offline
      tommytrojan
      wrote on last edited by
      #2

      Looks like it is related to having too many QLabels showing too many QPixmaps. I simplified my app to keep just a dozen or so QPixmaps, and the problem was gone.

      1 Reply Last reply
      0
      • Kent-DorfmanK Offline
        Kent-DorfmanK Offline
        Kent-Dorfman
        wrote on last edited by
        #3

        I despise work-arounds but maybe consider adding an event trap to suspend the program when it loses focus and resync when it regains focus?

        T 1 Reply Last reply
        0
        • Kent-DorfmanK Kent-Dorfman

          I despise work-arounds but maybe consider adding an event trap to suspend the program when it loses focus and resync when it regains focus?

          T Offline
          T Offline
          tommytrojan
          wrote on last edited by
          #4

          @Kent-Dorfman Thank you for your reply!

          Unfortunately suspending the program is not an option for my use case.

          I think eventually I need to meet the constraint of my OS and my hardware. If my device cannot handle too many QLabels, then maybe it is a sign that the structure of the program is not efficient.

          In this particular case, it is actually not necessary to have many QLabels. So to reduce its number is the right thing to do, I think.

          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