Dynamic removing webrtcbin from GstTee cause total pipeline paused
I use one tee for maybe 5 webrtcbins as receiver, and one appsrc as sender. Between appsrc and tee, I have GstQueue, named queue1. I try to remove one webrtcbin frequently. Then i found queue1 paused sometimes, then block all the pipeline.
I even use GST_PAD_PROBE_TYPE_IDLE to unlink teepad using gst_pad_unlink before removing webrtcbin, code like, gst_pad_add_probe(sink->teepad, GST_PAD_PROBE_TYPE_IDLE, unlink_cb, sink, (GDestroyNotify)g_free);
But I can still produce pipeline block, queue1 paused. I dig into the source code, when peer(chrome) leaves, I find teepad change to GST_FLOW_FLUSHING(-2) state even without removing webrtcbin from pipeline, I think changing to GST_FLOW_FLUSHING state is inevitable. Below is the state related log:
tee gsttee.c:940:gst_tee_handle_data:videotee:src_4 Starting to push buffer 0000027DC865E000 0:00:03.219030000 9820 0000027DC5905800 INFO GST_SCHEDULING gstpad.c:4860:gst_pad_push_data:videotee:src_4 error pushing events, return flushing 0:00:03.219759000 9820 0000027DC5905800 INFO tee gsttee.c:945:gst_tee_handle_data:videotee:src_4 Pushing item 0000027DC865E000 yielded result flushing pad src_4 0:00:03.220583000 9820 0000027DC5905800 INFO tee gsttee.c:1013:gst_tee_handle_data: received error flushing 0:00:03.222496000 9820 0000027DC5905800 INFO GST_PADS gstpad.c:4468:gst_pad_chain_data_unchecked: chainfunc return2 queue videotee return -2 funcname gst_tee_chain pad sink 0:00:03.223200000 9820 0000027DC5905800 INFO GST_SCHEDULING gstpad.c:4478:gst_pad_chain_data_unchecked:videotee:sink called chainfunction &gst_tee_chain with buffer 0000027DC865E000, returned flushing 0:00:03.223904000 9820 0000027DC5905800 INFO GST_PADS gstpad.c:4511:gst_pad_chain_data_unchecked: chainfunc return queue videotee pad sink return -2 0:00:03.227789000 9820 0000027DC5905800 INFO GST_SCHEDULING gstpad.c:4478:gst_pad_chain_data_unchecked:caps:sink called chainfunction &gst_base_transform_chain with buffer 0000027DC865E000, returned flushing 0:00:03.228397000 9820 0000027DC5905800 INFO GST_PADS gstpad.c:4511:gst_pad_chain_data_unchecked: chainfunc return queue caps pad sink return -2 0:00:03.228885000 9820 0000027DC5905800 INFO GST_SCHEDULING gstpad.c:4500:gst_pad_chain_data_unchecked:caps:sink called chainlistfunction &gst_pad_chain_list_default, returned flushing ret -2 0:00:03.229151000 9820 0000027DC5905800 INFO GST_PADS gstpad.c:4511:gst_pad_chain_data_unchecked: chainfunc return queue caps pad sink return -2 0:00:03.229579000 9820 0000027DC5905800 INFO task gsttask.c:733:gst_task_set_state_unlocked:queuebb:src Changing task 0000027DC5907290 to state 2 0:00:03.230532000 9820 0000027DC5905800 INFO queue_dataflow gstqueue.c:1660:gst_queue_loop: pause task, reason: flushing 0:00:03.231669000 9820 0000027DC5905800 INFO task gsttask.c:369:gst_task_func:queuebb:src Task 0000027DC5907290 going to paused
from function gst_tee_handle_data, while (pads) { GstPad pad; / stop pushing more buffers when we have a fatal error */ if (G_UNLIKELY (ret != GST_FLOW_OK && ret != GST_FLOW_NOT_LINKED)) goto error; pads = g_list_next (pads); } if one pad is not OK, then all pads will be affected. How about move goto error out? So, what can I do to dynamically remove webrtcbin from tee without affect other webrtcbin? Please advise.
Thanks.