Strange RTP packet from DirectTransport Consume

Hello to all community, and specially developers for this great product!

I am trying to consume RTP packets from directTransport.consume and I send RTP packets from there to external ffmpeg. When I listen the audio, I note a little “tick” every 4 ~ 5 seconds. I think tha ffmpeg was caused this issue. To confirm I used gstreamer, and the same issue. Also I change DirectTransport to PlainTransport to connect to external UDP port, and also get the same issue (audio ticks).

Well, after that I tried to debug those RTP packets comes from Direct/Plain Transport. After that I found the “tick”. This is caused by three RTP packets comes every 5 seconds, and with the help of another superb software (rtp.js) I can see these.

Sorry for the long, but this can show those strange packets that I don’t know what means. When these “strange” packets comes, there is no payload, and I log the raw packet instead of inexisten payload.

Extensions: [Map Entries] { [ 1, <Buffer 30> ], [ 10, <Buffer b8> ] }
Padding: 0
Seq: 506
OneExt: true
TwoExt false
isRtp: true
isRtcp: false
Payload: 7833396aa75ea80f716cfba07f00c4b421026d33d3fe4a7354e11f41466abeb50c5605fcca74daaeb8c02659fff7b256e3c60c197f2e9e9049e03fbde991dd5f
---------------------
Extensions: [Map Entries] { [ 1, <Buffer 30> ], [ 10, <Buffer b8> ] }
Padding: 0
Seq: 507
OneExt: true
TwoExt false
isRtp: true
isRtcp: false
Payload: 7832cdd2b8614c653ae5a8b4b80c8383edf962934fce6dceb5fdadddad2e517117456252fe52d31923c9c5492e30db3927aa6335b334d0765b98d51671651b265056ddb6
---------------------
Extensions: [Map Entries] { [ 1, <Buffer 30> ], [ 10, <Buffer b8> ] }
Padding: 0
Seq: 508
OneExt: true
TwoExt false
isRtp: true
isRtcp: false
Payload: 78315b1af77755162e5590003434563d9cffdf2147833965ceae5acf09c7b6ff38c7cb74966db7db72c2abf03dc71c43bf676cda655dd30fa86d959e3611d8b0670e1b92f5ff0164
---------------------
Extensions: [Map Entries] { [ 1, <Buffer 30> ], [ 10, <Buffer b8> ] }
Padding: 0
Seq: 509
OneExt: true
TwoExt false
isRtp: true
isRtcp: false
Payload: 7833396aaf3f1ec17e2d44640db37e504465bf1b8ae5d99cf0c3d9b80290bf35f918e34e42f99f70668178ff9ca0bbcc22a2cf9fcb41d4ab67cecf6c9479b63c64
---------------------
Extensions: [Map Entries] { [ 1, <Buffer 30> ], [ 10, <Buffer b8> ] }
Padding: 0
Seq: 510
OneExt: true
TwoExt false
isRtp: true
isRtcp: false
Payload: 78330172da90829f5921234d8cc0a48992d4e8d45eba44bf100914dbe355b0eee8db52801126ec38e7c63fe1f6fb4ad1b154bce452fe07cf1b2221f67ce62178486d
---------------------
Extensions: [Map Entries] { [ 1, <Buffer 30> ] }
Padding: 50
Seq: 512
OneExt: true
TwoExt false
isRtp: true
isRtcp: false
Raw Packet: b06f02009f24af461333e07fbede00031030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032
---------------------
Extensions: [Map Entries] { [ 1, <Buffer 30> ], [ 10, <Buffer b8> ] }
Padding: 0
Seq: 511
OneExt: true
TwoExt false
isRtp: true
isRtcp: false
Payload: 78330720a2726461c9449089520e053dc95490ef4f1a6fa5505c05a6c1f801d994ffce4e575c361415deae6dc41636c322fc349e2c9a7cf833c5ca478844a1ee
---------------------
Extensions: [Map Entries] { [ 1, <Buffer 30> ] }
Padding: 50
Seq: 513
OneExt: true
TwoExt false
isRtp: true
isRtcp: false
Raw Packet: b06f02019f24af461333e07fbede00031030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032
---------------------
Extensions: [Map Entries] { [ 1, <Buffer 30> ] }
Padding: 50
Seq: 514
OneExt: true
TwoExt false
isRtp: true
isRtcp: false
Raw Packet: b06f02029f24af461333e07fbede00031030000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000032
---------------------
Extensions: [Map Entries] { [ 1, <Buffer 30> ], [ 10, <Buffer b8> ] }
Padding: 0
Seq: 515
OneExt: true
TwoExt false
isRtp: true
isRtcp: false
Payload: 7832893bf792e208a025ae9534913bc47ebbb8e155b1bbbf25e3a9c5338c8c087fec37288ed9cfc1f695092871bba0fc52ac280b4dd0bc0568cfa7c9b3cbfef57fad
---------------------
Extensions: [Map Entries] { [ 1, <Buffer 30> ], [ 10, <Buffer b7> ] }
Padding: 0
Seq: 516
OneExt: true
TwoExt false
isRtp: true
isRtcp: false
Payload: 783118b3253f4aff93050e18a5643e65afd89a4c3af85cb473680e2a2c529cd7fe1864440fd1279938e8aed28840d34ee11e127830415e7e9b7181027fde3b397810074ab4315674
---------------------
Extensions: [Map Entries] { [ 1, <Buffer 30> ], [ 10, <Buffer b8> ] }
Padding: 0
Seq: 517
OneExt: true
TwoExt false
isRtp: true
isRtcp: false
Payload: 783118b30334fb7d75760b183fdd163b0771b43cb5fd2c145abd2b5b787ff43adb531dbc0c67fe98ef5c019545876aa8c0429d32f5ed0842c3ee3b8fc388023d647ccc3a64d95f
-

The packets are marked with sequence numbers 512, 513, and 514

Please note in the mentioned packets, they sequence numbers change the order. Exactly the same pattern repeats every 4 o 5 seconds.

So, the question is, what means these packets?

Using mediasoup V 3.7.15.

Regards

Verify if the ssrc of those packets is 1234.

Hello Iñaki. Thanks for the fast reply.

No, it is no 1234. It is the same as normal packets.

Look at the 50 padding:

Padding: 0
SSRC: 115947813
---------------------
Padding: 0
SSRC: 115947813
---------------------
Padding: 0
SSRC: 115947813
---------------------
Padding: 50
SSRC: 115947813
---------------------
Padding: 0
SSRC: 115947813
---------------------
Padding: 50
SSRC: 115947813
---------------------
Padding: 50
SSRC: 115947813
---------------------
Padding: 0
SSRC: 115947813
---------------------
Padding: 0
SSRC: 115947813

It would be nice if you used rtpPacket.dump() method which prints payload size as well.

Yes, sorry, it’s private API, but you can use it. It does this:

	dump(): any
	{
		const extensions: { [key: number]: { length: number } } = {};

		for (const [ id, value ] of this.extensions)
		{
			extensions[id] = { length: value.length };
		}

		return {
			version           : this.getVersion(),
			payloadType       : this.getPayloadType(),
			sequenceNumber    : this.getSequenceNumber(),
			timestamp         : this.getTimestamp(),
			ssrc              : this.getSsrc(),
			csrc              : this.csrc,
			marker            : this.getMarker(),
			headerExtensionId : this.headerExtensionId,
			extensions        : extensions,
			payloadLength     : this.payload.length,
			padding           : this.padding
		};
	}

Excellent Iñaki. rtpPacket.dump() output:

{
  version: 2,
  payloadType: 111,
  sequenceNumber: 508,
  timestamp: 900037215,
  ssrc: 578680429,
  csrc: [],
  marker: false,
  headerExtensionId: 48862,
  extensions: { '1': { length: 1 }, '10': { length: 1 } },
  payloadLength: 73,
  padding: 0
}
---------------------
{
  version: 2,
  payloadType: 111,
  sequenceNumber: 510,
  timestamp: 900038175,
  ssrc: 578680429,
  csrc: [],
  marker: false,
  headerExtensionId: 48862,
  extensions: { '1': { length: 1 } },
  payloadLength: 0,
  padding: 50
}
---------------------
{
  version: 2,
  payloadType: 111,
  sequenceNumber: 509,
  timestamp: 900038175,
  ssrc: 578680429,
  csrc: [],
  marker: false,
  headerExtensionId: 48862,
  extensions: { '1': { length: 1 }, '10': { length: 1 } },
  payloadLength: 71,
  padding: 0
}
---------------------
{
  version: 2,
  payloadType: 111,
  sequenceNumber: 511,
  timestamp: 900039135,
  ssrc: 578680429,
  csrc: [],
  marker: false,
  headerExtensionId: 48862,
  extensions: { '1': { length: 1 }, '10': { length: 1 } },
  payloadLength: 67,
  padding: 0
}
---------------------
{
  version: 2,
  payloadType: 111,
  sequenceNumber: 512,
  timestamp: 900039135,
  ssrc: 578680429,
  csrc: [],
  marker: false,
  headerExtensionId: 48862,
  extensions: { '1': { length: 1 } },
  payloadLength: 0,
  padding: 50
}
---------------------
{
  version: 2,
  payloadType: 111,
  sequenceNumber: 513,
  timestamp: 900039135,
  ssrc: 578680429,
  csrc: [],
  marker: false,
  headerExtensionId: 48862,
  extensions: { '1': { length: 1 } },
  payloadLength: 0,
  padding: 50
}
---------------------
{
  version: 2,
  payloadType: 111,
  sequenceNumber: 514,
  timestamp: 900040095,
  ssrc: 578680429,
  csrc: [],
  marker: false,
  headerExtensionId: 48862,
  extensions: { '1': { length: 1 }, '10': { length: 1 } },
  payloadLength: 67,
  padding: 0
}
---------------------
{
  version: 2,
  payloadType: 111,
  sequenceNumber: 515,
  timestamp: 900041055,
  ssrc: 578680429,
  csrc: [],
  marker: false,
  headerExtensionId: 48862,
  extensions: { '1': { length: 1 }, '10': { length: 1 } },
  payloadLength: 63,
  padding: 0
}
---------------------

Which are the suspicious packets there? those with payloadLength: 0?

Yes (for me). These causes a tic in audio when I decoded. I asked because I don’t know why happens. Also sequence are not ordered.
Of course, I fix this checking payload length, and decoded only when it is > 0.

This is how real RTP transmission is in real networks, no real issue here.

Those are generated by the producer endpoint, let’s say Chrome. mediasoup does not generate those packets at all. They may be generated by Chrome as a way to test the uplink capacity.

The thing here is: those have payload length 0, so a proper receiving endpoint should be able to discard them (in the sense that there is no real codec payload to process). However, from the point of view of RTP protocol, it’s perfectly fine to send those packets.

1 Like

Thank you so much Iñaky for the clarification!! :ok_hand:

I had a similar problem with ffmpeg, as documented in this thread:

I fixed it on the ffmpeg side by just ignoring any packet with a length of 0. I’m using the C interface to ffmpeg, I’m not sure if that’s possible with the command line.

This only started becoming a problem with recent version of libwebrtc (around M89 I think)

1 Like

Yes!!! Five minutes ago I see your post. There is same or similar issue, endpoints issues (Chrome, etc) as Iñaky said. After that I ignored empty payloads and runs like a charm.

Thank you

1 Like