Gstreamer/Deepstream 多输入源输入,打开失败源判断

当使用uridecodebin插件打开多输入源时,发现在打开任一源失败时,在消息监听回调会返回GST_MESSAGE_ERROR错误消息从而退出管道,详细错误信息是

gstrtspsrc.c(7469): gst_rtspsrc_retrieve_sdp (): /GstPipeline:StreamTogetherProcess/GstBin:decode-bin-1/GstURIDecodeBin:uri-decode-bin1/GstRTSPSrc:source:Failed to connect. (Generic error)
初衷是想通过返回错误消息携带的GstMessage * msg中 GstObject   *src的对象名src->name来确定是哪个流打开失败,但是通过打印发现每一个对象名都是source完全相同,很无奈。

但是GstRTSPSrc:source这个element对象是在uridecodebin插件中动态创建的,我甚至想在动态创建后对这个对象重新设置name属性,但是更改无效。

最后发现可以通过GstRTSPSrc:source父类parent属性的name来确定哪一个数据源打开失败。

如下:

case GST_MESSAGE_ERROR:
	{
		gchar *debug;
		GError *error;
		gst_message_parse_error(msg, &error, &debug);
		dzlog_error("element :%s,element parent:%s,message:%s", msg->src->name, msg->src->parent->name,error->message);
		if (debug)
			dzlog_error("Error details: %s\n", debug);
		g_free(debug);
		g_error_free(error);
		g_main_loop_quit(loop);
		break;
	}

打印结果如下:

[2022-05-16 11:10:00.179][INFO ][AIStreamTask.cpp:969]Decodebin child added:source

[2022-05-16 11:10:00.180][INFO ][AIStreamTask.cpp:969]Decodebin child added:source

[2022-05-16 11:10:00.183][INFO ][AIStreamTask.cpp:796]Running...

[2022-05-16 11:10:00.250][ERROR ][AIStreamTask.cpp:909]element:source,element parent:uri-decode-bin1,message:Could not open resource for reading and writing.
[2022-05-16 11:10:00.250][ERROR][AIStreamTask.cpp:911]Error details: gstrtspsrc.c(7469): gst_rtspsrc_retrieve_sdp (): /GstPipeline:StreamTogetherProcess/GstBin:decode-bin-1/GstURIDecodeBin:uri-decode-bin1/GstRTSPSrc:source:
Failed to connect. (Generic error)

我们可以看到这个uri-decode-bin1里面的数字1就是源ID这个是自己定义的这个是在:

g_snprintf(bin_name, 32, "uri-decode-bin%d", nStreamID);
    dzlog_info("bin_name:%s", bin_name);
    uri_decode_bin = gst_element_factory_make("uridecodebin", bin_name);

时添加进去的。接下来我们就可以根据这个流ID进行相关元件的gst_bin_remove操作了。

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值