Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 13 additions & 10 deletions engine.go
Original file line number Diff line number Diff line change
Expand Up @@ -342,13 +342,14 @@ func (e *RTCEngine) configure(
func (e *RTCEngine) createPublisherPCLocked(configuration webrtc.Configuration) error {
var err error
if e.publisher, err = NewPCTransport(PCTransportParams{
Configuration: configuration,
Codecs: e.connParams.Codecs,
RetransmitBufferSize: e.connParams.RetransmitBufferSize,
Pacer: e.connParams.Pacer,
Interceptors: e.connParams.Interceptors,
OnRTTUpdate: e.setRTT,
IsSender: true,
Configuration: configuration,
Codecs: e.connParams.Codecs,
RetransmitBufferSize: e.connParams.RetransmitBufferSize,
Pacer: e.connParams.Pacer,
Interceptors: e.connParams.Interceptors,
IncludeDefaultInterceptors: e.connParams.IncludeDefaultInterceptors,
OnRTTUpdate: e.setRTT,
IsSender: true,
}); err != nil {
return err
}
Expand Down Expand Up @@ -429,9 +430,11 @@ func (e *RTCEngine) createSubscriberPCLocked(configuration webrtc.Configuration)

var err error
if e.subscriber, err = NewPCTransport(PCTransportParams{
Configuration: configuration,
Codecs: e.connParams.Codecs,
RetransmitBufferSize: e.connParams.RetransmitBufferSize,
Configuration: configuration,
Codecs: e.connParams.Codecs,
RetransmitBufferSize: e.connParams.RetransmitBufferSize,
Interceptors: e.connParams.Interceptors,
IncludeDefaultInterceptors: e.connParams.IncludeDefaultInterceptors,
}); err != nil {
return err
}
Expand Down
8 changes: 8 additions & 0 deletions room.go
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,14 @@ func WithInterceptors(interceptors []interceptor.Factory) ConnectOption {
}
}

// WithIncludeDefaultInterceptors sets whether to register default interceptors
// along with custom interceptors.
func WithIncludeDefaultInterceptors(include bool) ConnectOption {
return func(p *signalling.ConnectParams) {
p.IncludeDefaultInterceptors = include
}
}

// WithICETransportPolicy sets the ICE transport policy (UDP, Relay, etc.).
func WithICETransportPolicy(iceTransportPolicy webrtc.ICETransportPolicy) ConnectOption {
return func(p *signalling.ConnectParams) {
Expand Down
2 changes: 2 additions & 0 deletions signalling/interfaces.go
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ type ConnectParams struct {

Interceptors []interceptor.Factory

IncludeDefaultInterceptors bool

ICETransportPolicy webrtc.ICETransportPolicy

// internal use
Expand Down
17 changes: 12 additions & 5 deletions transport.go
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,12 @@ type PCTransportParams struct {
Configuration webrtc.Configuration
Codecs []webrtc.RTPCodecParameters

RetransmitBufferSize uint16
Pacer pacer.Factory
Interceptors []interceptor.Factory
OnRTTUpdate func(rtt uint32)
IsSender bool
RetransmitBufferSize uint16
Pacer pacer.Factory
Interceptors []interceptor.Factory
IncludeDefaultInterceptors bool
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good overall,

this formatting looks off, can you please check that?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. Thanks

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything else need to be done?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this is good to go.

OnRTTUpdate func(rtt uint32)
IsSender bool
}

func (t *PCTransport) registerDefaultInterceptors(params PCTransportParams, i *interceptor.Registry) error {
Expand Down Expand Up @@ -172,6 +173,12 @@ func NewPCTransport(params PCTransportParams) (*PCTransport, error) {
for _, c := range params.Interceptors {
i.Add(c)
}
if params.IncludeDefaultInterceptors {
err := t.registerDefaultInterceptors(params, i)
if err != nil {
return nil, err
}
}
} else {
err := t.registerDefaultInterceptors(params, i)
if err != nil {
Expand Down
Loading