mirror of
https://github.com/aler9/gortsplib
synced 2025-10-05 07:06:58 +08:00
add OnTransportSwitch, OnPacketLost, OnDecodeError to server and client (#225)
These new hooks replace the generic hooks Log() and OnWarning().
This commit is contained in:
@@ -1454,7 +1454,13 @@ func TestServerRecordDecodeErrors(t *testing.T) {
|
||||
StatusCode: base.StatusOK,
|
||||
}, nil
|
||||
},
|
||||
onWarning: func(ctx *ServerHandlerOnWarningCtx) {
|
||||
onPacketLost: func(ctx *ServerHandlerOnPacketLostCtx) {
|
||||
if ca.proto == "udp" && ca.name == "rtp packets lost" {
|
||||
require.EqualError(t, ctx.Error, "69 RTP packet(s) lost")
|
||||
}
|
||||
close(errorRecv)
|
||||
},
|
||||
onDecodeError: func(ctx *ServerHandlerOnDecodeErrorCtx) {
|
||||
switch {
|
||||
case ca.proto == "udp" && ca.name == "rtp invalid":
|
||||
require.EqualError(t, ctx.Error, "RTP header size insufficient: 2 < 4")
|
||||
@@ -1462,9 +1468,6 @@ func TestServerRecordDecodeErrors(t *testing.T) {
|
||||
case ca.proto == "udp" && ca.name == "rtcp invalid":
|
||||
require.EqualError(t, ctx.Error, "rtcp: packet too short")
|
||||
|
||||
case ca.proto == "udp" && ca.name == "rtp packets lost":
|
||||
require.EqualError(t, ctx.Error, "69 RTP packet(s) lost")
|
||||
|
||||
case ca.proto == "udp" && ca.name == "rtp too big":
|
||||
require.EqualError(t, ctx.Error, "RTP packet is too big to be read with UDP")
|
||||
|
||||
|
Reference in New Issue
Block a user