test the excpetion fds first in the select loop
in streaming_set_m2m. This is needed in the next patch
in order to dequeue a source change event before its
coresponding last buffer.

Signed-off-by: Dafna Hirschfeld <daf...@gmail.com>
---
 utils/v4l2-ctl/v4l2-ctl-streaming.cpp | 26 +++++++++++++-------------
 1 file changed, 13 insertions(+), 13 deletions(-)

diff --git a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp 
b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
index 3e81fdfc..fc204304 100644
--- a/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
+++ b/utils/v4l2-ctl/v4l2-ctl-streaming.cpp
@@ -1953,6 +1953,19 @@ static void streaming_set_m2m(cv4l_fd &fd)
                        goto done;
                }
 
+               if (ex_fds && FD_ISSET(fd.g_fd(), ex_fds)) {
+                       struct v4l2_event ev;
+
+                       while (!fd.dqevent(ev)) {
+                               if (ev.type != V4L2_EVENT_EOS)
+                                       continue;
+                               wr_fds = NULL;
+                               fprintf(stderr, "EOS");
+                               fflush(stderr);
+                               break;
+                       }
+               }
+
                if (rd_fds && FD_ISSET(fd.g_fd(), rd_fds)) {
                        r = do_handle_cap(fd, in, file[CAP], NULL,
                                          count[CAP], fps_ts[CAP]);
@@ -1990,19 +2003,6 @@ static void streaming_set_m2m(cv4l_fd &fd)
                                }
                        }
                }
-
-               if (ex_fds && FD_ISSET(fd.g_fd(), ex_fds)) {
-                       struct v4l2_event ev;
-
-                       while (!fd.dqevent(ev)) {
-                               if (ev.type != V4L2_EVENT_EOS)
-                                       continue;
-                               wr_fds = NULL;
-                               fprintf(stderr, "EOS");
-                               fflush(stderr);
-                               break;
-                       }
-               }
        }
 
        fcntl(fd.g_fd(), F_SETFL, fd_flags);
-- 
2.17.1

Reply via email to