replace OnDecodeError with OnWarning (#177)

This commit is contained in:
Alessandro Ros
2023-01-23 12:54:57 +01:00
committed by GitHub
parent 14fcde1c69
commit a2d6ce8af6
12 changed files with 69 additions and 44 deletions

View File

@@ -153,13 +153,13 @@ func (sm *serverSessionMedia) readRTCPUDPPlay(payload []byte) error {
atomic.AddUint64(sm.ss.bytesReceived, uint64(plen))
if plen == (maxPacketSize + 1) {
onDecodeError(sm.ss, fmt.Errorf("RTCP packet is too big to be read with UDP"))
onWarning(sm.ss, fmt.Errorf("RTCP packet is too big to be read with UDP"))
return nil
}
packets, err := rtcp.Unmarshal(payload)
if err != nil {
onDecodeError(sm.ss, err)
onWarning(sm.ss, err)
return nil
}
@@ -176,20 +176,20 @@ func (sm *serverSessionMedia) readRTPUDPRecord(payload []byte) error {
atomic.AddUint64(sm.ss.bytesReceived, uint64(plen))
if plen == (maxPacketSize + 1) {
onDecodeError(sm.ss, fmt.Errorf("RTP packet is too big to be read with UDP"))
onWarning(sm.ss, fmt.Errorf("RTP packet is too big to be read with UDP"))
return nil
}
pkt := &rtp.Packet{}
err := pkt.Unmarshal(payload)
if err != nil {
onDecodeError(sm.ss, err)
onWarning(sm.ss, err)
return nil
}
forma, ok := sm.formats[pkt.PayloadType]
if !ok {
onDecodeError(sm.ss, fmt.Errorf("received RTP packet with unknown payload type (%d)", pkt.PayloadType))
onWarning(sm.ss, fmt.Errorf("received RTP packet with unknown payload type (%d)", pkt.PayloadType))
return nil
}
@@ -206,13 +206,13 @@ func (sm *serverSessionMedia) readRTCPUDPRecord(payload []byte) error {
atomic.AddUint64(sm.ss.bytesReceived, uint64(plen))
if plen == (maxPacketSize + 1) {
onDecodeError(sm.ss, fmt.Errorf("RTCP packet is too big to be read with UDP"))
onWarning(sm.ss, fmt.Errorf("RTCP packet is too big to be read with UDP"))
return nil
}
packets, err := rtcp.Unmarshal(payload)
if err != nil {
onDecodeError(sm.ss, err)
onWarning(sm.ss, err)
return nil
}
@@ -241,14 +241,14 @@ func (sm *serverSessionMedia) readRTPTCPPlay(payload []byte) error {
func (sm *serverSessionMedia) readRTCPTCPPlay(payload []byte) error {
if len(payload) > maxPacketSize {
onDecodeError(sm.ss, fmt.Errorf("RTCP packet size (%d) is greater than maximum allowed (%d)",
onWarning(sm.ss, fmt.Errorf("RTCP packet size (%d) is greater than maximum allowed (%d)",
len(payload), maxPacketSize))
return nil
}
packets, err := rtcp.Unmarshal(payload)
if err != nil {
onDecodeError(sm.ss, err)
onWarning(sm.ss, err)
return nil
}
@@ -268,7 +268,7 @@ func (sm *serverSessionMedia) readRTPTCPRecord(payload []byte) error {
forma, ok := sm.formats[pkt.PayloadType]
if !ok {
onDecodeError(sm.ss, fmt.Errorf("received RTP packet with unknown payload type (%d)", pkt.PayloadType))
onWarning(sm.ss, fmt.Errorf("received RTP packet with unknown payload type (%d)", pkt.PayloadType))
return nil
}
@@ -278,14 +278,14 @@ func (sm *serverSessionMedia) readRTPTCPRecord(payload []byte) error {
func (sm *serverSessionMedia) readRTCPTCPRecord(payload []byte) error {
if len(payload) > maxPacketSize {
onDecodeError(sm.ss, fmt.Errorf("RTCP packet size (%d) is greater than maximum allowed (%d)",
onWarning(sm.ss, fmt.Errorf("RTCP packet size (%d) is greater than maximum allowed (%d)",
len(payload), maxPacketSize))
return nil
}
packets, err := rtcp.Unmarshal(payload)
if err != nil {
onDecodeError(sm.ss, err)
onWarning(sm.ss, err)
return nil
}