gst-zeromq
gst-zeromq copied to clipboard
Trying to stop the pipeline whilst the src is awaiting data results in a hang
Blocked by
https://github.com/mjhowell/gst-zeromq/blob/master/src/zeromq/gstzmqsrc.c#L187
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.
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;