GStreamer UDPSink阻止财产无效?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了GStreamer UDPSink阻止财产无效?相关的知识,希望对你有一定的参考价值。

我正在使用GStreamer并使用此管道发送音频:

gst-launch-1.0 -v filesrc location=soundfile.mp3 ! mad ! audioconvert ! audio/x-raw, layout=interleaved, format=F32LE, channels=2 ! udpsink blocksize=512 port=5005 host=127.0.0.1

然而,blocksize似乎根本没有工作。这是udpsink的文档,由gst-inspect udpsink访问:

Element Properties:
  name                : The name of the object
                        flags: readable, writable
                        String. Default: "udpsink0"
  preroll-queue-len   : Number of buffers to queue during preroll
                        flags: readable, writable
                        Unsigned Integer. Range: 0 - 4294967295 Default: 0 
  sync                : Sync on the clock
                        flags: readable, writable
                        Boolean. Default: true
  max-lateness        : Maximum number of nanoseconds that a buffer can be late before it is dropped (-1 unlimited)
                        flags: readable, writable
                        Integer64. Range: -1 - 9223372036854775807 Default: -1 
  qos                 : Generate Quality-of-Service events upstream
                        flags: readable, writable
                        Boolean. Default: false
  async               : Go asynchronously to PAUSED
                        flags: readable, writable
                        Boolean. Default: true
  ts-offset           : Timestamp offset in nanoseconds
                        flags: readable, writable
                        Integer64. Range: -9223372036854775808 - 9223372036854775807 Default: 0 
  enable-last-buffer  : Enable the last-buffer property
                        flags: readable, writable
                        Boolean. Default: true
  last-buffer         : The last buffer received in the sink
                        flags: readable
                        MiniObject of type "GstBuffer"
  blocksize           : Size in bytes to pull per buffer (0 = default)
                        flags: readable, writable
                        Unsigned Integer. Range: 0 - 4294967295 Default: 4096 
  render-delay        : Additional render delay of the sink in nanoseconds
                        flags: readable, writable
                        Unsigned Integer64. Range: 0 - 18446744073709551615 Default: 0 
  throttle-time       : The time to keep between rendered buffers (unused)
                        flags: readable, writable
                        Unsigned Integer64. Range: 0 - 18446744073709551615 Default: 0 
  bytes-to-serve      : Number of bytes received to serve to clients
                        flags: readable
                        Unsigned Integer64. Range: 0 - 18446744073709551615 Default: 0 
  bytes-served        : Total number of bytes sent to all clients
                        flags: readable
                        Unsigned Integer64. Range: 0 - 18446744073709551615 Default: 0 
  sockfd              : Socket to use for UDP sending. (-1 == allocate)
                        flags: readable, writable
                        Integer. Range: -1 - 2147483647 Default: -1 
  closefd             : Close sockfd if passed as property on state change
                        flags: readable, writable
                        Boolean. Default: true
  sock                : Socket currently in use for UDP sending. (-1 == no socket)
                        flags: readable
                        Integer. Range: -1 - 2147483647 Default: -1 
  clients             : A comma separated list of host:port pairs with destinations
                        flags: readable, writable
                        String. Default: "localhost:4951"
  auto-multicast      : Automatically join/leave the multicast groups, FALSE means user has to do it himself
                        flags: readable, writable
                        Boolean. Default: true
  ttl                 : Used for setting the unicast TTL parameter
                        flags: readable, writable
                        Integer. Range: 0 - 255 Default: 64 
  ttl-mc              : Used for setting the multicast TTL parameter
                        flags: readable, writable
                        Integer. Range: 0 - 255 Default: 1 
  loop                : Used for setting the multicast loop parameter. TRUE = enable, FALSE = disable
                        flags: readable, writable
                        Boolean. Default: true
  qos-dscp            : Quality of Service, differentiated services code point (-1 default)
                        flags: readable, writable
                        Integer. Range: -1 - 63 Default: -1 
  send-duplicates     : When a distination/port pair is added multiple times, send packets multiple times as well
                        flags: readable, writable
                        Boolean. Default: true
  buffer-size         : Size of the kernel send buffer in bytes, 0=default
                        flags: readable, writable
                        Integer. Range: 0 - 2147483647 Default: 0 
  host                : The host/IP/Multicast group to send the packets to
                        flags: readable, writable
                        String. Default: "localhost"
  port                : The port to send the packets to
                        flags: readable, writable
                        Integer. Range: 0 - 65535 Default: 4951 

这已经有些令人困惑了,因为blocksize的默认值被列为0和4096.但是,它似乎是4096,因为这是我的UDP数据包大小,无论我使用什么值为blocksize。更令人困惑的是,我几乎无法在网上找到任何关于blocksize财产的信息,即使是在GStreamer自己的文档中:http://gstreamer.freedesktop.org/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-udpsink.html

提到的唯一属性是hostportblocksize已经被弃用了吗?如果是这样,有没有办法控制每个UDP数据包中发送的数据量?我已经尝试在RTP中使用mtu属性而没有运气(见这里:gstreamer RTP packet size),并且我有点在这里。

答案

当您在元素上使用gstinspect时,它会显示所有属性 - 不仅来自特定元素,还来自其父元素。这是真正预期的行为。

UdpSink确实只有hostport财产。父母 - GstMultiUDPSink有更多。

您可以在树的形式(对象层次结构段落)中找到GStreamer文档中的继承链。不幸的是,并非所有链接都正常工作,因此最好为父元素谷歌正确链接。

好的,回到问题,你提到的blocksizeGstBaseSink 的财产,被描述为:

在拉模式下操作时要拉出的字节数。标志:读/写

默认值:4096

因此,它定义了从上游元素中提取的数据量。它不会影响UDP数据包。你正在寻找的是buffer-sizeGstMultiUDPSink财产:

“buffer-size”gint内核发送缓冲区的大小,以字节为单位,0 =默认值。

标志:读/写

允许值:> = 0

默认值:0

以上是关于GStreamer UDPSink阻止财产无效?的主要内容,如果未能解决你的问题,请参考以下文章

如何将 opencv mat 写入 gstreamer 管道?

gstreamer视频进入python中的窗口

Gstreamer:为啥我不能在 localhost 上通过 UDP 发送数据?

Gstreamer Video Overlay 在 QWidget 上的无效投射,Windows 10

udpsink 似乎没有流任何东西,但 fileink 工作

jquery的mouseover方法如何阻止事件冒泡