client: fix reading sources without server ports (bluenviron/mediamtx#4253) (#796)

RTCP packets were sent out to nil addresses, due to the lack of server
ports, causing an error.
This commit is contained in:
Alessandro Ros
2025-06-08 12:45:05 +02:00
committed by GitHub
parent d98036a493
commit ff85f6156a
2 changed files with 25 additions and 2 deletions

View File

@@ -67,7 +67,7 @@ func (cf *clientFormat) start() {
Period: cf.cm.c.receiverReportPeriod,
TimeNow: cf.cm.c.timeNow,
WritePacketRTCP: func(pkt rtcp.Packet) {
if cf.cm.udpRTPListener != nil {
if cf.cm.udpRTPListener != nil && cf.cm.udpRTCPListener.writeAddr != nil {
cf.cm.c.WritePacketRTCP(cf.cm.media, pkt) //nolint:errcheck
}
},