mirror of
https://github.com/aler9/gortsplib
synced 2025-10-06 15:46:51 +08:00
allow invalid RTCP packets in both client and server
(https://github.com/aler9/rtsp-simple-server/issues/1085) Invalid RTCP packets, in both server and client, do not trigger a fatal error anymore but they're just blocked. OnDecodeError() is called in order to emit a warning.
This commit is contained in:
@@ -1494,6 +1494,7 @@ func TestServerPublishDecodeErrors(t *testing.T) {
|
||||
{"udp", "rtp packets lost"},
|
||||
{"udp", "rtp too big"},
|
||||
{"udp", "rtcp too big"},
|
||||
{"tcp", "rtcp invalid"},
|
||||
{"tcp", "rtcp too big"},
|
||||
} {
|
||||
t.Run(ca.proto+" "+ca.name, func(t *testing.T) {
|
||||
@@ -1533,6 +1534,9 @@ func TestServerPublishDecodeErrors(t *testing.T) {
|
||||
case ca.proto == "udp" && ca.name == "rtcp too big":
|
||||
require.EqualError(t, ctx.Error, "RTCP packet is too big to be read with UDP")
|
||||
|
||||
case ca.proto == "tcp" && ca.name == "rtcp invalid":
|
||||
require.EqualError(t, ctx.Error, "rtcp: packet too short")
|
||||
|
||||
case ca.proto == "tcp" && ca.name == "rtcp too big":
|
||||
require.EqualError(t, ctx.Error, "RTCP packet size (2000) is greater than maximum allowed (1472)")
|
||||
}
|
||||
@@ -1682,6 +1686,13 @@ func TestServerPublishDecodeErrors(t *testing.T) {
|
||||
Port: resTH.ServerPorts[1],
|
||||
})
|
||||
|
||||
case ca.proto == "tcp" && ca.name == "rtcp invalid":
|
||||
err = conn.WriteInterleavedFrame(&base.InterleavedFrame{
|
||||
Channel: 1,
|
||||
Payload: []byte{0x01, 0x02},
|
||||
}, make([]byte, 2048))
|
||||
require.NoError(t, err)
|
||||
|
||||
case ca.proto == "tcp" && ca.name == "rtcp too big":
|
||||
err = conn.WriteInterleavedFrame(&base.InterleavedFrame{
|
||||
Channel: 1,
|
||||
|
Reference in New Issue
Block a user