call OnDecodeError when rtpcleaner returns an error

This commit is contained in:
aler9
2022-10-31 18:51:29 +01:00
parent b1f72f9392
commit 0e6a0b8b25
8 changed files with 196 additions and 109 deletions

View File

@@ -1483,6 +1483,7 @@ func TestServerPublishDecodeErrors(t *testing.T) {
"packets lost",
"rtp too big",
"rtcp too big",
"cleaner error",
} {
t.Run(ca, func(t *testing.T) {
errorRecv := make(chan struct{})
@@ -1516,6 +1517,8 @@ func TestServerPublishDecodeErrors(t *testing.T) {
require.EqualError(t, ctx.Error, "RTP packet is too big to be read with UDP")
case "rtcp too big":
require.EqualError(t, ctx.Error, "RTCP packet is too big to be read with UDP")
case "cleaner error":
require.EqualError(t, ctx.Error, "packet type not supported (STAP-B)")
}
close(errorRecv)
},
@@ -1534,11 +1537,23 @@ func TestServerPublishDecodeErrors(t *testing.T) {
defer nconn.Close()
conn := conn.NewConn(nconn)
tracks := Tracks{&TrackH264{
PayloadType: 96,
SPS: []byte{0x01, 0x02, 0x03, 0x04},
PPS: []byte{0x01, 0x02, 0x03, 0x04},
}}
var track Track
if ca != "cleaner error" {
track = &TrackGeneric{
Media: "application",
Payloads: []TrackGenericPayload{{
Type: 97,
RTPMap: "private/90000",
}},
}
} else {
track = &TrackH264{
PayloadType: 96,
SPS: []byte{0x01, 0x02, 0x03, 0x04},
PPS: []byte{0x01, 0x02, 0x03, 0x04},
}
}
tracks := Tracks{track}
tracks.setControls()
res, err := writeReqReadRes(conn, base.Request{
@@ -1649,6 +1664,18 @@ func TestServerPublishDecodeErrors(t *testing.T) {
IP: net.ParseIP("127.0.0.1"),
Port: resTH.ServerPorts[1],
})
case "cleaner error":
byts, _ := rtp.Packet{
Header: rtp.Header{
SequenceNumber: 100,
},
Payload: []byte{0x99},
}.Marshal()
l1.WriteTo(byts, &net.UDPAddr{
IP: net.ParseIP("127.0.0.1"),
Port: resTH.ServerPorts[0],
})
}
<-errorRecv