gStreamer-Sharp动态垫未链接 [英] gStreamer-Sharp Dynamic pads not linking
本文介绍了gStreamer-Sharp动态垫未链接的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我忘了提到这是在使用轴编码器.
I forgot to mention this is working with an axis encoder.
我最近开始使用gStreamer-sharp,我可以使用playbin播放视频,但是我需要实时播放视频,因此需要设置延迟.但是我遇到了这个错误:
I've recently started using gStreamer-sharp and I can get a video playing with playbin but I need my video to be live, thus a need to set the latency. but I have come across this error:
GST_ELEMENT_PADS gstelement.c:722:gst_element_add_pad:<Source> adding pad 'recv_rtp_src_0_219678342_96'
0:00:11.033000000 13088 05418DA0 INFO basesrc gstbasesrc.c:2519:gst_base_src_loop:<udpsrc1> pausing after gst_pad_push() = not-linked
0:00:11.033000000 13088 05418DA0 WARN basesrc gstbasesrc.c:2582:gst_base_src_loop:<udpsrc1> error: Internal data flow error.
0:00:11.033000000 13088 05418DA0 WARN basesrc gstbasesrc.c:2582:gst_base_src_loop:<udpsrc1> error: streaming task paused, reason not-linked (-1)
0:00:11.214000000 13088 05418DA0 INFO GST_ERROR_SYSTEM gstelement.c:1931:gst_element_message_full:<udpsrc1> posting message: Internal data flow error.
0:00:11.214000000 13088 05418DA0 INFO GST_ERROR_SYSTEM gstelement.c:1954:gst_element_message_full:<udpsrc1> posted error message: Internal data flow error.
这使我相信垫子的代码有问题,如下所示:
Which has lead me to believe it's a problem with the pad's my code is as following:
Gst.Video.VideoSink videoSink;
Pipeline m_Pipeline;
Element m_Source, m_Demux, m_Decoder, m_Space;
private void OnVideoPadAdded(object sender, Gst.PadAddedArgs args)
{
Gst.Element.Link(m_Demux, m_Decoder);
}
private void CreatePipeline()
{
m_Pipeline = new Pipeline("video player");
m_Source = Gst.ElementFactory.Make("rtspsrc", "Source");
m_Source["location"] = @"rtsp://root:root@192.168.8.159:554/axis-media/media.3gp";
m_Demux = Gst.ElementFactory.Make("rtph264depay", "Depay");
m_Decoder = Gst.ElementFactory.Make("ffdec_h264", "Decoder");
m_Space = ElementFactory.Make("ffmpegcolorspace", "Space");
videoSink = Gst.ElementFactory.Make("directdrawsink", "Output") as Gst.Video.VideoSink;
videoSink["force-aspect-ratio"] = true;
m_Pipeline.Add(m_Source, m_Demux, m_Decoder, m_Space, videoSink);
m_Pipeline.SetState(Gst.State.Ready);
m_Source.Link(m_Demux);
m_Demux.PadAdded += new Gst.PadAddedHandler(OnVideoPadAdded);
m_Decoder.Link(m_Space);
m_Space.Link(videoSink);
var overlay = new Gst.Interfaces.XOverlayAdapter(videoSink.Handle);
overlay.XwindowId = (ulong)videoPanel.Handle;
m_Pipeline.SetState(Gst.State.Paused);
m_Pipeline.SetState(State.Playing);
}
感谢您的帮助.
推荐答案
最后,解决方案非常简单.
Solution was pretty simple in the end.
需要添加处理程序:
m_Source.PadAdded += new Gst.PadAddedHandler(OnVideoPadAdded);
然后通过在处理程序中获取静态垫来正确处理接收器:
then handle the sink correctly by getting the static pad in the handler:
Pad sinkpad = m_Demux.GetStaticPad("sink");
args.Pad.Link(sinkpad);
这篇关于gStreamer-Sharp动态垫未链接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文