Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trying to stop the pipeline whilst the src is awaiting data results in a hang #5

Open
mangodan2003 opened this issue Nov 18, 2022 · 2 comments

Comments

@mangodan2003
Copy link

Blocked by

https://github.com/mjhowell/gst-zeromq/blob/master/src/zeromq/gstzmqsrc.c#L187

@mjhowell
Copy link
Owner

Hi @mangodan2003, I haven't touched this in a long time so it is not fresh in my mind. The code you highlight doesn't seem to have a nice way to be interrupted, so perhaps would be better calling zmq_msg_recv() with a timeout, or using zmq_poll().

Can you give a concrete example that I can use to reproduce your problem? gst-launch-1.0 command lines, etc.

@Frenzie
Copy link

Frenzie commented May 23, 2024

A simple gst-launch like this will suffice:

gst-launch-1.0 -v zmqsrc endpoint=ipc:///tmp/bla-src ! fakesink dump=1

Compare the behavior when pressing Ctrl+C with udpsrc for example. udpsrc is immediate, zmqsrc takes a very long time.

Something along these lines does better in that test case but unfortunately not in a less artificial scenario.

-    rc = zmq_msg_recv (&msg, src->socket, 0);
+    rc = zmq_msg_recv (&msg, src->socket, ZMQ_DONTWAIT);
     if ((rc < 0) && (EAGAIN == errno)) {
       GST_LOG_OBJECT (src, "No message available on socket, errno: %d", errno);
+      g_main_context_iteration (NULL, FALSE);
+      g_usleep (1000);  // sleep for 1 millisecond
       continue;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants