Unplugging camera blocks Qt GUI in RTSP streaming

When camera is unplugged in RTSP streaming, no bus error messages. A probe is added to the pipeline and a timer is applied to check if the pipeline is still active in 4s interval. But it seems unplugging camera blocks even timer and Qt event loops. GUI is frozen and nothing works. How to handle this scenario? Run pipeline in a separate thread?

Gstreamer 1.22.5 and Yocto

Which element are you using to capture from the camera? Are you handling bus errors?

Thank you for your reply. Bus errors are handled. No bus error is displayed.
source element: rtspsrc
decoder: imxvpudec_h264
Qt5 sink: qmlglsink
RTSP streaming On Yocto.

Can you clarify what you meant by “unplug the source” Did you mean to unplug the ethernet cable ?

Right. I found out the bus message handler is never called. Tried to send EOS event to the pipeline and nothing comes out in the handler. Will let you know if I find the causes.

It seems event loops of Qt are blocked after the ethernet cable is unplugged.
Even Qt timer stops working. The mouse has to be moved a bit to update the
GUI on the screen. Then, Qt code will work fine again. I think the QT QML sink blocks Qt GUI update. How to solve this issue?

Disconnection is detected by other tools. Since event loops of Qt are blocked, the update call of GUI can not be executed.

If you have a stall, maybe a backtrace would show where the program has stalled?

Thanks for your reply, Matthew. The backtrace is as follows:

0:00:25.307125250  3711 0xffff74001520 INFO            videodecoder gstvideodecoder.c:1649:gst_video_decoder_sink_event_default:<imxvpudech264-0> upstr;
0:00:26.039554500  3711 0xffff74001520 INFO            videodecoder gstvideodecoder.c:1649:gst_video_decoder_sink_event_default:<imxvpudech264-0> upstr;
0:00:26.307177625  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:27.307364000  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:28.306761000  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:29.307078375  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:30.307706000  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:31.306812250  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:32.306736500  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:33.307565250  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:34.306911875  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:35.307030125  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:36.307135125  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:37.307217875  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:38.306793000  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:39.307531500  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:40.306666875  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:41.306616875  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
0:00:42.306430500  3711 0xffff74001520 INFO               baseparse gstbaseparse.c:4120:gst_base_parse_set_latency:<h264parse0> min/max latency 0:00:000
                                                                                                                                                        
---------------------------unplug here---------------------------------------------                                                                                                                        
                                                                                                                                                        
0:01:11.189590125  3711 0xffff68017c70 WARN                 rtspsrc gstrtspsrc.c:3700:on_timeout_common:<rtspsrc0> source bcf406a7, stream bcf406a7 in t
0:01:11.190089625  3711 0xffff74000f50 INFO                 basesrc gstbasesrc.c:2918:gst_base_src_loop:<udpsrc0> pausing after gst_base_src_get_range(g
0:01:11.190137000  3711 0xffff74000f50 INFO                    task gsttask.c:368:gst_task_func:<udpsrc0:src> Task going to paused                      
0:01:11.190536875  3711 0xffff74000f50 INFO                    task gsttask.c:370:gst_task_func:<udpsrc0:src> Task resume from paused                   
0:01:11.190563875  3711 0xffff74001140 INFO                 basesrc gstbasesrc.c:2918:gst_base_src_loop:<udpsrc1> pausing after gst_base_src_get_range(g
0:01:11.190575000  3711 0xffff74000f50 INFO                 basesrc gstbasesrc.c:2918:gst_base_src_loop:<udpsrc0> pausing after gst_base_src_get_range(s
0:01:11.190768250  3711 0xffff74000f50 INFO                    task gsttask.c:368:gst_task_func:<udpsrc0:src> Task going to paused                      
0:01:11.190608125  3711 0xffff74001140 INFO                    task gsttask.c:368:gst_task_func:<udpsrc1:src> Task going to paused                      
0:01:11.191016250  3711 0xffff74001140 INFO                    task gsttask.c:370:gst_task_func:<udpsrc1:src> Task resume from paused                   
0:01:11.191050375  3711 0xffff74001140 INFO                 basesrc gstbasesrc.c:2918:gst_base_src_loop:<udpsrc1> pausing after gst_base_src_get_range(s
0:01:11.191121500  3711 0xffff74001330 INFO                    task gsttask.c:368:gst_task_func:<rtpjitterbuffer0:src> Task going to paused             
0:01:11.191230000  3711 0xffff74001710 INFO                    task gsttask.c:368:gst_task_func:<rtpjitterbuffer1:src> Task going to paused             
0:01:11.191130000  3711 0xffff74001140 INFO                    task gsttask.c:368:gst_task_func:<udpsrc1:src> Task going to paused                      
0:01:11.191262375  3711 0xffff74001520 INFO               imxvpudec gstimxvpudec.c:672:gst_imx_vpu_dec_finish:<imxvpudech264-0> pushing out all remainis
0:01:11.191406375  3711 0xffff74001520 INFO                    task gsttask.c:368:gst_task_func:<queue2-0:src> Task going to paused   

That is not a backtrace from a debugger. That is a debug log.

Sorry. GUI is not responding when gdb is attached to the app in Yocto. I will try to get backtrace on Ubuntu.

Can not get any gstreamer info in the backtrace since a stop button has to be pressed to update Qt GUI. There is only Qt GUI info in the backtrace. Any suggestions?

thread apply all bt in gdb will provide backtrace for every threads.

Qt problem. Need upgrade of Qt. Thanks.