Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Shifted arrival times when some packets in TransportLayerCC have expired #260

Open
anders-avos opened this issue Jul 4, 2024 · 0 comments

Comments

@anders-avos
Copy link

Your environment.

  • Version: master
  • Browser: N/A

What did you do?

When TransportLayerCC packets are parsed in feedback_adapter.go the refTime and deltaIndex are only updated for packets found in history. If only some packets in the report are missing from history this leads to subsequent packets getting the wrong arrival time. See test below.

What did you expect?

The arrival time for packets still in history should be correct even if some earlier packets in the report expired.

func TestRecvDeltaOutOfSync(t *testing.T) {
	adapter := NewFeedbackAdapter()

	t0 := time.Time{}
	headers := []rtp.Header{}
	// passes when packet count is <= 250
	for i := uint16(0); i < 251; i++ {
		pkt := getPacketWithTransportCCExt(t, i)
		headers = append(headers, pkt.Header)
		assert.NoError(t, adapter.OnSent(t0, &pkt.Header, 1200, interceptor.Attributes{TwccExtensionAttributesKey: hdrExtID}))
	}

	results, err := adapter.OnTransportCCFeedback(t0, &rtcp.TransportLayerCC{
		Header:             rtcp.Header{},
		SenderSSRC:         0,
		MediaSSRC:          0,
		BaseSequenceNumber: 0,
		PacketStatusCount:  22,
		ReferenceTime:      0,
		FbPktCount:         0,
		PacketChunks: []rtcp.PacketStatusChunk{
			&rtcp.StatusVectorChunk{
				PacketStatusChunk: nil,
				Type:              rtcp.TypeTCCStatusVectorChunk,
				SymbolSize:        rtcp.TypeTCCSymbolSizeTwoBit,
				SymbolList: []uint16{
					rtcp.TypeTCCPacketReceivedSmallDelta,
					rtcp.TypeTCCPacketReceivedSmallDelta,
				},
			},
		},
		RecvDeltas: []*rtcp.RecvDelta{
			{
				Type:  rtcp.TypeTCCPacketReceivedSmallDelta,
				Delta: 3,
			},
			{
				Type:  rtcp.TypeTCCPacketReceivedSmallDelta,
				Delta: 6,
			},
		},
	})

	assert.NoError(t, err)

	assert.NotEmpty(t, results)
	assert.Len(t, results, 2)

	assert.Contains(t, results, Acknowledgment{
		SequenceNumber: 1,
		Size:           headers[1].MarshalSize() + 1200,
		Departure:      t0,
		Arrival:        t0.Add(9 * time.Microsecond),
	})
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

1 participant