Skip to content

Commit

Permalink
Fix CSIGENERAL-2720: 1 core 100% after opening cam
Browse files Browse the repository at this point in the history
Remove FD that returns error in poll from FD to be polled in future
iterations.
  • Loading branch information
fkesseler committed Mar 9, 2023
1 parent ce8daf9 commit fe3641b
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions Source/Source/V4L2EventHandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,11 +60,8 @@ void V4L2EventHandler::UnsubscribeControl(int id)

void V4L2EventHandler::run()
{


while (!isInterruptionRequested())
{

std::vector<pollfd> pfds;

for (const auto fd : m_Fds)
Expand All @@ -89,6 +86,15 @@ void V4L2EventHandler::run()
{
for (const auto & pfd : pfds)
{
if (pfd.revents & POLLERR)
{
auto const idx = &pfd - pfds.data();
if (idx < m_Fds.size())
{
m_Fds.erase(m_Fds.begin() + idx);
}
}

if (pfd.revents & POLLPRI)
{
v4l2_event event = {0};
Expand Down

0 comments on commit fe3641b

Please sign in to comment.