mirror of
https://github.com/pion/webrtc.git
synced 2025-09-26 19:21:12 +08:00
Log error when Read is used with simulcast
This commit is contained in:
@@ -44,6 +44,8 @@ const (
|
|||||||
|
|
||||||
incomingUnhandledRTPSsrc = "Incoming unhandled RTP ssrc(%d), OnTrack will not be fired. %v"
|
incomingUnhandledRTPSsrc = "Incoming unhandled RTP ssrc(%d), OnTrack will not be fired. %v"
|
||||||
|
|
||||||
|
useReadSimulcast = "Use ReadSimulcast(rid) instead of Read() when multiple tracks are present"
|
||||||
|
|
||||||
generatedCertificateOrigin = "WebRTC"
|
generatedCertificateOrigin = "WebRTC"
|
||||||
|
|
||||||
// AttributeRtxPayloadType is the interceptor attribute added when Read()
|
// AttributeRtxPayloadType is the interceptor attribute added when Read()
|
||||||
|
@@ -14,6 +14,7 @@ import (
|
|||||||
"time"
|
"time"
|
||||||
|
|
||||||
"github.com/pion/interceptor"
|
"github.com/pion/interceptor"
|
||||||
|
"github.com/pion/logging"
|
||||||
"github.com/pion/rtcp"
|
"github.com/pion/rtcp"
|
||||||
"github.com/pion/srtp/v3"
|
"github.com/pion/srtp/v3"
|
||||||
"github.com/pion/webrtc/v4/internal/util"
|
"github.com/pion/webrtc/v4/internal/util"
|
||||||
@@ -70,6 +71,8 @@ type RTPReceiver struct {
|
|||||||
api *API
|
api *API
|
||||||
|
|
||||||
rtxPool sync.Pool
|
rtxPool sync.Pool
|
||||||
|
|
||||||
|
log logging.LeveledLogger
|
||||||
}
|
}
|
||||||
|
|
||||||
// NewRTPReceiver constructs a new RTPReceiver.
|
// NewRTPReceiver constructs a new RTPReceiver.
|
||||||
@@ -78,7 +81,7 @@ func (api *API) NewRTPReceiver(kind RTPCodecType, transport *DTLSTransport) (*RT
|
|||||||
return nil, errRTPReceiverDTLSTransportNil
|
return nil, errRTPReceiverDTLSTransportNil
|
||||||
}
|
}
|
||||||
|
|
||||||
r := &RTPReceiver{
|
rtpReceiver := &RTPReceiver{
|
||||||
kind: kind,
|
kind: kind,
|
||||||
transport: transport,
|
transport: transport,
|
||||||
api: api,
|
api: api,
|
||||||
@@ -88,9 +91,10 @@ func (api *API) NewRTPReceiver(kind RTPCodecType, transport *DTLSTransport) (*RT
|
|||||||
rtxPool: sync.Pool{New: func() any {
|
rtxPool: sync.Pool{New: func() any {
|
||||||
return make([]byte, api.settingEngine.getReceiveMTU())
|
return make([]byte, api.settingEngine.getReceiveMTU())
|
||||||
}},
|
}},
|
||||||
|
log: api.settingEngine.LoggerFactory.NewLogger("RTPReceiver"),
|
||||||
}
|
}
|
||||||
|
|
||||||
return r, nil
|
return rtpReceiver, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (r *RTPReceiver) setRTPTransceiver(tr *RTPTransceiver) {
|
func (r *RTPReceiver) setRTPTransceiver(tr *RTPTransceiver) {
|
||||||
@@ -272,6 +276,10 @@ func (r *RTPReceiver) Receive(parameters RTPReceiveParameters) error {
|
|||||||
func (r *RTPReceiver) Read(b []byte) (n int, a interceptor.Attributes, err error) {
|
func (r *RTPReceiver) Read(b []byte) (n int, a interceptor.Attributes, err error) {
|
||||||
select {
|
select {
|
||||||
case <-r.received:
|
case <-r.received:
|
||||||
|
if len(r.tracks) > 1 {
|
||||||
|
r.log.Errorf(useReadSimulcast)
|
||||||
|
}
|
||||||
|
|
||||||
return r.tracks[0].rtcpInterceptor.Read(b, a)
|
return r.tracks[0].rtcpInterceptor.Read(b, a)
|
||||||
case <-r.closed:
|
case <-r.closed:
|
||||||
return 0, nil, io.ErrClosedPipe
|
return 0, nil, io.ErrClosedPipe
|
||||||
|
Reference in New Issue
Block a user