@@ -61,6 +61,8 @@ type WHIPServer struct {
61
61
62
62
handlersLock sync.Mutex
63
63
handlers map [string ]WHIPHandler
64
+
65
+ getWhipProxyEnabled func (ctx context.Context , streamKey string ) bool
64
66
}
65
67
66
68
type WHIPHandler interface {
@@ -93,6 +95,7 @@ func NewWHIPServer(bus psrpc.MessageBus) (*WHIPServer, error) {
93
95
func (s * WHIPServer ) Start (
94
96
conf * config.Config ,
95
97
onPublish func (streamKey , resourceId string ) (* params.Params , func (mimeTypes map [types.StreamKind ]string , err error ) * stats.LocalMediaStatsGatherer , func (error ), error ),
98
+ getWhipProxyEnabled func (ctx context.Context , streamKey string ) bool ,
96
99
healthHandlers HealthHandlers ,
97
100
) error {
98
101
s .ctx , s .cancel = context .WithCancel (context .Background ())
@@ -104,6 +107,7 @@ func (s *WHIPServer) Start(
104
107
}
105
108
106
109
s .onPublish = onPublish
110
+ s .getWhipProxyEnabled = getWhipProxyEnabled
107
111
s .conf = conf
108
112
109
113
var err error
@@ -359,7 +363,8 @@ func (s *WHIPServer) createStream(streamKey string, sdpOffer string, ua string)
359
363
}
360
364
361
365
var h WHIPHandler
362
- if * p .EnableTranscoding || ! s .conf .SFUTranscodingBypassedWHIP {
366
+ if * p .EnableTranscoding || (! s .conf .SFUTranscodingBypassedWHIP &&
367
+ (s .getWhipProxyEnabled == nil || ! s .getWhipProxyEnabled (ctx , streamKey ))) {
363
368
logger .Infow ("Using native WHIP handler" , "ingressID" , p .IngressId , "resourceID" , resourceId , "streamKey" , streamKey )
364
369
365
370
var bus psrpc.MessageBus
0 commit comments