Gstreamer 释放管道时,如果电缆断开,rtspsrc会阻塞

Gstreamer 释放管道时,如果电缆断开,rtspsrc会阻塞,gstreamer,rtsp,Gstreamer,Rtsp,这是我用来显示RTSP流的管道: gst-launch-1.0 location="rtsp://192.168.82.51:554/axis-media/media.amp?videocodec=h264" latency=150 drop-on-latency=true tcp-timeout=50000 timeout=200000 teardown-timeout=10000000 do-retransmission=false ! decodebin ! video

这是我用来显示RTSP流的管道:

gst-launch-1.0 location="rtsp://192.168.82.51:554/axis-media/media.amp?videocodec=h264" latency=150 drop-on-latency=true tcp-timeout=50000 timeout=200000 teardown-timeout=10000000 do-retransmission=false ! decodebin ! videoconvert ! autovideosink
它是有效的。 现在,如果我断开电缆,然后尝试松开管道,它会阻塞大约30秒。部分日志如下所示:

0:00:35.688277878  3264   0x7f980392d0 DEBUG                 udpsrc gstudpsrc.c:1024:gst_udpsrc_fill: stop called
0:00:35.688318848  3264   0x7f980392d0 DEBUG                basesrc gstbasesrc.c:1558:gst_base_src_default_create:<udpsrc2> fill returned -2 (flushing)
0:00:35.688355579  3264   0x7f980392d0 DEBUG                basesrc gstbasesrc.c:513:gst_base_src_wait_playing_unlocked:<udpsrc2> live source waiting for running state
0:00:35.688432490  3264   0x7f980392d0 DEBUG                basesrc gstbasesrc.c:515:gst_base_src_wait_playing_unlocked:<udpsrc2> live source unlocked
0:00:35.688464780  3264   0x7f980392d0 DEBUG                basesrc gstbasesrc.c:526:gst_base_src_wait_playing_unlocked:<udpsrc2> we are flushing
0:00:35.688496800  3264   0x7f980392d0 DEBUG                basesrc gstbasesrc.c:2653:gst_base_src_get_range:<udpsrc2> wait_playing returned -2 (flushing)
0:00:35.688527241  3264   0x7f980392d0 INFO                 basesrc gstbasesrc.c:2853:gst_base_src_loop:<udpsrc2> pausing after gst_base_src_get_range() = flushing
0:00:35.688757583  3264   0x7f980392d0 DEBUG                basesrc gstbasesrc.c:3025:gst_base_src_loop:<udpsrc2> pausing task, reason flushing
0:00:35.688863824  3264   0x55a5839050 DEBUG                basesrc gstbasesrc.c:3696:gst_base_src_set_flushing:<udpsrc2> flushing 0
0:00:35.688900794  3264   0x55a5839050 LOG                   udpsrc gstudpsrc.c:1628:gst_udpsrc_unlock_stop:<udpsrc2> No longer flushing
0:00:35.688962955  3264   0x55a5839050 DEBUG                basesrc gstbasesrc.c:3114:gst_base_src_set_allocation:<udpsrc2> deactivate old pool
0:00:35.689132167  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:8014:gst_rtspsrc_close:<rtspsrc0> Teardown on rtsp://192.168.82.51:554/axis-media/media.amp?videocodec=h264
0:00:35.689223448  3264   0x55a5839050 DEBUG                rtspsrc gstrtspsrc.c:522:default_before_send:<rtspsrc0> default handler
0:00:35.689257778  3264   0x55a5839050 DEBUG                rtspsrc gstrtspsrc.c:522:default_before_send:<rtspsrc0> default handler
0:00:35.689287658  3264   0x55a5839050 DEBUG                rtspsrc gstrtspsrc.c:6367:gst_rtspsrc_try_send:<rtspsrc0> sending message
0:00:35.689316158  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9380:gst_rtspsrc_print_rtsp_message:<rtspsrc0> --------------------------------------------
0:00:35.689347549  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9383:gst_rtspsrc_print_rtsp_message:<rtspsrc0> RTSP request message 0x7fa4a37608
0:00:35.689390209  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9384:gst_rtspsrc_print_rtsp_message:<rtspsrc0>  request line:
0:00:35.689449340  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9385:gst_rtspsrc_print_rtsp_message:<rtspsrc0>    method: 'TEARDOWN'
0:00:35.689507710  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9387:gst_rtspsrc_print_rtsp_message:<rtspsrc0>    uri:    'rtsp://192.168.82.51:554/axis-media/media.amp?videocodec=h264'
0:00:35.689562511  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9388:gst_rtspsrc_print_rtsp_message:<rtspsrc0>    version: '1.0'
0:00:35.689589891  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9390:gst_rtspsrc_print_rtsp_message:<rtspsrc0>  headers:
0:00:35.689625322  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9363:dump_key_value:<rtspsrc0>    key: 'User-Agent', value: 'GStreamer/1.16.2'
0:00:35.689652172  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9392:gst_rtspsrc_print_rtsp_message:<rtspsrc0>  body:
0:00:35.689679262  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9472:gst_rtspsrc_print_rtsp_message:<rtspsrc0> --------------------------------------------
void ifm::cam::dspl::{anonymous}::OnSurfaceChange(t_ilm_surface, ilmSurfaceProperties*, t_ilm_notification_mask)
            surface = 8388864
            mask = 0x2
0:01:06.479647990  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9380:gst_rtspsrc_print_rtsp_message:<rtspsrc0> --------------------------------------------
0:01:06.479757301  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9402:gst_rtspsrc_print_rtsp_message:<rtspsrc0> RTSP response message 0x7fa4a37660
0:01:06.479791031  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9403:gst_rtspsrc_print_rtsp_message:<rtspsrc0>  status line:
0:01:06.479831082  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9404:gst_rtspsrc_print_rtsp_message:<rtspsrc0>    code:   '200'
0:01:06.479861612  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9405:gst_rtspsrc_print_rtsp_message:<rtspsrc0>    reason: 'OK'
0:01:06.479892352  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9406:gst_rtspsrc_print_rtsp_message:<rtspsrc0>    version: '1.0
0:01:06.479922453  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9408:gst_rtspsrc_print_rtsp_message:<rtspsrc0>  headers:
0:01:06.479960243  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9363:dump_key_value:<rtspsrc0>    key: 'CSeq', value: '6'
0:01:06.479997163  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9363:dump_key_value:<rtspsrc0>    key: 'Server', value: 'GStreamer RTSP server'
0:01:06.480032784  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9363:dump_key_value:<rtspsrc0>    key: 'Session', value: '9kyYyfRp36O0tMM8; timeout=60'
0:01:06.480067724  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9363:dump_key_value:<rtspsrc0>    key: 'Date', value: 'Sun, 29 Dec 2024 04:00:47 GMT'
0:01:06.480100854  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9411:gst_rtspsrc_print_rtsp_message:<rtspsrc0>  body: length 0
0:01:06.480131445  3264   0x55a5839050 LOG                  rtspsrc gstrtspsrc.c:9472:gst_rtspsrc_print_rtsp_message:<rtspsrc0> --------------------------------------------
0:01:06.480161405  3264   0x55a5839050 DEBUG                rtspsrc gstrtspsrc.c:6269:gst_rtsp_src_receive_response:<rtspsrc0> received response message
0:01:06.480193545  3264   0x55a5839050 DEBUG                rtspsrc gstrtspsrc.c:6288:gst_rtsp_src_receive_response:<rtspsrc0> got response message 200
0:01:06.480232436  3264   0x55a5839050 DEBUG                rtspsrc gstrtspsrc.c:8041:gst_rtspsrc_close:<rtspsrc0> closing connection...
0:01:06.480264636  3264   0x55a5839050 DEBUG                rtspsrc gstrtspsrc.c:5059:gst_rtsp_conninfo_close:<rtspsrc0> closing connection...
0:01:06.480415767  3264   0x55a5839050 DEBUG                rtspsrc gstrtspsrc.c:5065:gst_rtsp_conninfo_close:<rtspsrc0> freeing connection...
0:01:06.480472408  3264   0x55a5839050 DEBUG                rtspsrc gstrtspsrc.c:2336:gst_rtspsrc_cleanup:<rtspsrc0> cleanup
0:01:06.480506128  3264   0x55a5839050 DEBUG                rtspsrc gstrtspsrc.c:2272:gst_rtspsrc_stream_free:<rtspsrc0> free stream 0x7f9801d490
0:01:06.480585459  3264   0x55a5839050 DEBUG                 udpsrc gstudpsrc.c:1639:gst_udpsrc_close: closing sockets
0:01:06.481007963  3264   0x55a5839050 DEBUG                 udpsrc gstudpsrc.c:1639:gst_udpsrc_close: closing sockets
0:01:06.481383237  3264   0x55a5839050 DEBUG                basesrc gstbasesrc.c:3927:gst_base_src_change_state:<fakesrc0> PLAYING->PAUSED
0:00:35.688277878 3264 0x7f980392d0调试udpsrc gstudpsrc.c:1024:gst\U udpsrc\U填充:调用停止
0:00:35.688318848 3264 0x7F98039200调试basesrc gstbasesrc.c:1558:gst_base_src_default_create:fill返回-2(刷新)
0:00:35.688355579 3264 0x7f980392d0调试basesrc gstbasesrc.c:513:gst_base_src_wait_playing_unlocked:live source等待运行状态
0:00:35.688432490 3264 0x7f980392d0调试basesrc gstbasesrc.c:515:gst\u base\u src\u wait\u playing\u unlocked:live source unlocked
0:00:35.688464780 3264 0x7F98039200调试基gstbasesrc.c:526:gst\U基src\U等待\U播放\U解锁:我们正在刷新
0:00:35.688496800 3264 0x7F98039200调试basesrc gstbasesrc.c:2653:gst_base_src_get_range:wait_playing returned-2(刷新)
0:00:35.688527241 3264 0x7F98039200 INFO basesrc gstbasesrc.c:2853:gst_base_src_循环:gst_base_src_get_range()后暂停
0:00:35.688757583 3264 0x7F98039200调试basesrc gstbasesrc.c:3025:gst_base_src_循环:暂停任务,原因刷新
0:00:35.688863824 3264 0x55a5839050调试基线src gstbasesrc.c:3696:gst\U基线\U设置\U刷新:刷新0
0:00:35.688900794 3264 0x55a5839050日志udpsrc gstudpsrc.c:1628:gst\U udpsrc\U解锁\U停止:不再刷新
0:00:35.688962955 3264 0x55a5839050调试basesrc gstbasesrc.c:3114:gst\u base\u src\u set\u分配:停用旧池
0:00:35.689132167 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:8014:gst_rtspsrc_close:Teardown onrtsp://192.168.82.51:554/axis-媒体/媒体.amp?视频编解码器=h264
0:00:35.689223448 3264 0x55a5839050调试rtspsrc gstrtspsrc.c:522:default\u-before\u发送:默认处理程序
0:00:35.689257778 3264 0x55a5839050调试rtspsrc gstrtspsrc.c:522:发送前的默认\U:默认处理程序
0:00:35.689287658 3264 0x55a5839050调试rtspsrc gstrtspsrc.c:6367:gst\u rtspsrc\u try\u发送:发送消息
0:00:35.689316158 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9380:gst\u rtspsrc\u打印\u rtsp\u消息:--------------------------------------------
0:00:35.689347549 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9383:gst_rtspsrc_打印_rtsp_消息:rtsp请求消息0x7fa4a37608
0:00:35.689390209 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9384:gst\u rtspsrc\u print\u rtsp\u消息:请求行:
0:00:35.689449340 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9385:gst\u rtspsrc\u print\u rtsp\u消息:方法:“拆卸”
0:00:35.689507710 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9387:gst\u rtspsrc\u print\u rtsp\u消息:uri:'rtsp://192.168.82.51:554/axis-媒体/媒体.amp?视频编解码器=h264'
0:00:35.689562511 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9388:gst\u rtspsrc\u print\u rtsp\u消息:版本:“1.0”
0:00:35.6895891 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9390:gst\u rtspsrc\u print\u rtsp\u消息:标题:
0:00:35.6896253223264 0x55a5839050日志rtspsrc gstrtspsrc.c:9363:dump_key_value:key:'User Agent',value:'GStreamer/1.16.2'
0:00:35.689652172 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9392:gst\u rtspsrc\u print\u rtsp\u消息:正文:
0:00:35.689679262 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9472:gst\u rtspsrc\u打印\u rtsp\u消息:--------------------------------------------
void ifm::cam::dspl::{anonymous}::OnSurfaceChange(t_ilm_surface、ilmSurfaceProperties*、t_ilm_notification_mask)
表面=8388864
掩码=0x2
0:01:06.479647990 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9380:gst\u rtspsrc\u print\u rtsp\u消息:--------------------------------------------
0:01:06.479757301 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9402:gst_rtspsrc_打印_rtsp_消息:rtsp响应消息0x7fa4a37660
0:01:06.479791031 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9403:gst\u rtspsrc\u打印\u rtsp\u消息:状态行:
0:01:06.479831082 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9404:gst\u rtspsrc\u print\u rtsp\u消息:代码:“200”
0:01:06.4798612 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9405:gst\u rtspsrc\u print\u rtsp\u消息:原因:“确定”
0:01:06.479892352 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9406:gst\u rtspsrc\u print\u rtsp\u消息:版本:'1.0
0:01:06.479922453 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9408:gst\u rtspsrc\u print\u rtsp\u消息:标题:
0:01:06.479960243 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9363:dump_key_value:key:'CSeq',value:'6'
0:01:06.4799971633264 0x55a5839050日志rtspsrc gstrtspsrc.c:9363:dump_key_value:key:'Server',value:'GStreamer RTSP Server'
0:01:06.480032784 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9363:dump_key_value:key:'Session',value:'9kyyyyfrp36o0tmm8;超时=60'
0:01:06.480067724 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9363:dump_key_value:key:'Date',value:'Sun,2024年12月29日04:00:47 GMT'
0:01:06.480100854 3264 0x55a5839050日志rtspsrc gstrtspsrc.c:9411:gst\u rtspsrc\u print\u rtsp\u消息:正文:长度0
0:01:06.4801314453264 0x55a5839050日志rtspsrc gstrtspsrc.c:9472:gst\u rtspsrc\u print\u rtsp\u消息:--------------------------------------------
0:01:06.480164053264 0x55a5839050调试rtspsrc gstrtspsrc.c:6269:gst\U rtsp\U src\U接收响应:接收响应