No RTP retransmission when injecting video and audio from Gstreamer

I am trying to inject stream from an RTMP source to Mediasoup with the following Gstreamer command:

gst-launch-1.0 -v \
				rtpbin name=rtpbin \
				rtmpsrc location=${RTMP_URL} \
				! flvdemux name=demux \
				demux.video \
				! queue \
				! h264parse \
				! decodebin \
				! videoconvert \
				! vp8enc target-bitrate=2000000 deadline=1 cpu-used=-5 \
				! rtpvp8pay pt=102 ssrc=22222222 picture-id-mode=2 \
				! rtprtxqueue max-size-time=3000 max-size-packets=0 requests=2000 \
				! rtpbin.send_rtp_sink_0 \
				rtpbin.send_rtp_src_0 ! udpsink host=${listenIp} port=${videoRtpPort} \
				rtpbin.send_rtcp_src_0 ! udpsink host=${listenIp} port=${videoRtcpPort} sync=false async=false \
				udpsrc port=5005 ! rtpbin.recv_rtcp_sink_0 \
				demux.audio \
				! queue \
				! decodebin \
				! audioconvert \
				! audioresample ! audio/x-raw, rate=24000 \
				! opusenc \
				! rtpopuspay pt=101 ssrc=11111111 \
				! rtprtxqueue max-size-time=3000 max-size-packets=0 requests=2000 \
				! rtpbin.send_rtp_sink_1 \
				rtpbin.send_rtp_src_1 ! udpsink host=${listenIp} port=${audioRtpPort} \
				rtpbin.send_rtcp_src_1 ! udpsink host=${listenIp} port=${audioRtcpPort} sync=false async=false \
				udpsrc port=5007 ! rtpbin.recv_rtcp_sink_1

I am enabling RTCP feedback in the producer like so:

this._injectVideoProducer = await this._injectVideoTransport.produce({
				kind          : 'video',
				rtpParameters : {
					codecs : [
						{
							mimeType     : 'video/vp8',
							clockRate    : 90000,
							payloadType  : 102,
							rtcpFeedback : [
								{ type: 'nack' },
								{ type: 'nack', parameter: 'pli' },
								{ type: 'cm', parameter: 'fir' },
								{ type: 'goog-remb' }
							]
						}
					],
					encodings : [ { ssrc: 22222222 } ]
				}
			});

The result is the video freezes randomly and plays again after a few seconds. I believe this is due to RTP packet loss. Here is snap of pruducer stat:

Inject-video-producer stats:  [
   {
      "bitrate":2132493,
      "byteCount":151285009,
      "firCount":0,
      "fractionLost":0,
      "jitter":0,
      "kind":"video",
      "mimeType":"video/VP8",
      "nackCount":160,
      "nackPacketCount":1700,
      "packetCount":116907,
      "packetsDiscarded":0,
      "packetsLost":170,
      "packetsRepaired":0,
      "packetsRetransmitted":0,
      "pliCount":7,
      "score":10,
      "ssrc":22222222,
      "timestamp":796306772,
      "type":"inbound-rtp"
  }]

Here the nackCount and nackPacketCount are increased when I have a freeze in the video but the packetsRetransmitted always stay at zero.

Is Mediasoup sending the retransmission requests to Gstreamer properly? Or is the retransmission mechanism not working properly? Or the problem lies on the Gstreamer side? Here is snap from Gstreamer output log:

/GstPipeline:pipeline0/GstRtpBin:rtpbin/GstRtpSession:rtpsession1: 
stats = application/x-rtp-session-stats, rtx-drop-count=(uint)0, 
sent-nack-count=(uint)0, recv-nack-count=(uint)0, 
source-stats=(GValueArray)< "application/x-rtp-source-stats\,
\ ssrc\=\(uint\)11111111\,\ internal\=\(boolean\)true\,\ validated\=\(boolean\)true\,
\ received-bye\=\(boolean\)false\,\ is-csrc\=\(boolean\)false\,
\ is-sender\=\(boolean\)true\,\ seqnum-base\=\(int\)29231\,\ clock-rate\=\(int\)48000\,
\ octets-sent\=\(guint64\)22460160\,\ packets-sent\=\(guint64\)140376\,
\ octets-received\=\(guint64\)22460160\,\ packets-received\=\(guint64\)140376\,
\ bitrate\=\(guint64\)64000\,\ packets-lost\=\(int\)-140376\,\ jitter\=\(uint\)0\,
\ sent-pli-count\=\(uint\)0\,\ recv-pli-count\=\(uint\)0\,\ sent-fir-count\=\(uint\)0\,
\ recv-fir-count\=\(uint\)0\,\ sent-nack-count\=\(uint\)0\,\ recv-nack-count\=\(uint\)0\,
\ have-sr\=\(boolean\)true\,\ sr-ntptime\=\(guint64\)16547233726635086532\,
\ sr-rtptime\=\(uint\)3405294345\,\ sr-octet-count\=\(uint\)22436320\,
\ sr-packet-count\=\(uint\)140227\;" >, rtx-count=(uint)0, recv-rtx-req-count=(uint)0, 
sent-rtx-req-count=(uint)0;

As I am new to Mediasoup any hint will be much appreciated.

1 Like

Hello, iā€™m also have the same problem. Did you solve?