unexport RTCPSender, RTCPReceiver, LossDetector, Reorderer (#667)

This commit is contained in:
Alessandro Ros
2024-12-24 21:21:11 +01:00
committed by GitHub
parent 93b012b3ca
commit 8c4a3ca018
16 changed files with 1186 additions and 505 deletions

View File

@@ -6,11 +6,11 @@ import (
"github.com/pion/rtcp"
"github.com/pion/rtp"
"github.com/bluenviron/gortsplib/v4/internal/rtcpreceiver"
"github.com/bluenviron/gortsplib/v4/internal/rtplossdetector"
"github.com/bluenviron/gortsplib/v4/internal/rtpreorderer"
"github.com/bluenviron/gortsplib/v4/pkg/format"
"github.com/bluenviron/gortsplib/v4/pkg/liberrors"
"github.com/bluenviron/gortsplib/v4/pkg/rtcpreceiver"
"github.com/bluenviron/gortsplib/v4/pkg/rtplossdetector"
"github.com/bluenviron/gortsplib/v4/pkg/rtpreorderer"
)
type serverSessionFormat struct {
@@ -26,22 +26,23 @@ type serverSessionFormat struct {
func (sf *serverSessionFormat) start() {
if sf.sm.ss.state != ServerSessionStatePlay {
if *sf.sm.ss.setuppedTransport == TransportUDP || *sf.sm.ss.setuppedTransport == TransportUDPMulticast {
sf.udpReorderer = rtpreorderer.New()
sf.udpReorderer = &rtpreorderer.Reorderer{}
sf.udpReorderer.Initialize()
} else {
sf.tcpLossDetector = rtplossdetector.New()
sf.tcpLossDetector = &rtplossdetector.LossDetector{}
}
var err error
sf.rtcpReceiver, err = rtcpreceiver.New(
sf.format.ClockRate(),
nil,
sf.sm.ss.s.receiverReportPeriod,
sf.sm.ss.s.timeNow,
func(pkt rtcp.Packet) {
sf.rtcpReceiver = &rtcpreceiver.RTCPReceiver{
ClockRate: sf.format.ClockRate(),
Period: sf.sm.ss.s.receiverReportPeriod,
TimeNow: sf.sm.ss.s.timeNow,
WritePacketRTCP: func(pkt rtcp.Packet) {
if *sf.sm.ss.setuppedTransport == TransportUDP || *sf.sm.ss.setuppedTransport == TransportUDPMulticast {
sf.sm.ss.WritePacketRTCP(sf.sm.media, pkt) //nolint:errcheck
}
})
},
}
err := sf.rtcpReceiver.Initialize()
if err != nil {
panic(err)
}