@@ -87,13 +87,12 @@ type AudioOutput struct {
8787}
8888
8989func NewVideoOutput (codec livekit.VideoCodec , layer * livekit.VideoLayer , outputSync * utils.TrackOutputSynchronizer , isPlayingTooSlow func () bool , statsGatherer * stats.LocalMediaStatsGatherer , eos * eosDispatcher ) (* VideoOutput , error ) {
90- e , err := newVideoOutput (codec , outputSync , isPlayingTooSlow , eos )
90+ log := logger .GetLogger ().WithValues ("kind" , "video" , "layer" , layer .Quality .String ())
91+ e , err := newVideoOutput (codec , outputSync , isPlayingTooSlow , eos , log )
9192 if err != nil {
9293 return nil , err
9394 }
9495
95- e .logger = logger .GetLogger ().WithValues ("kind" , "video" , "layer" , layer .Quality .String ())
96-
9796 e .trackStatsGatherer = statsGatherer .RegisterTrackStats (fmt .Sprintf ("%s.%s" , stats .OutputVideo , layer .Quality .String ()))
9897
9998 e .latencyCaps = gst .NewCapsFromString (packetLatencyCaps )
@@ -251,13 +250,12 @@ func NewVideoOutput(codec livekit.VideoCodec, layer *livekit.VideoLayer, outputS
251250}
252251
253252func NewAudioOutput (options * livekit.IngressAudioEncodingOptions , outputSync * utils.TrackOutputSynchronizer , isPlayingTooSlow func () bool , statsGatherer * stats.LocalMediaStatsGatherer , eos * eosDispatcher ) (* AudioOutput , error ) {
254- e , err := newAudioOutput (options .AudioCodec , outputSync , isPlayingTooSlow , eos )
253+ log := logger .GetLogger ().WithValues ("kind" , "audio" )
254+ e , err := newAudioOutput (options .AudioCodec , outputSync , isPlayingTooSlow , eos , log )
255255 if err != nil {
256256 return nil , err
257257 }
258258
259- e .logger = logger .GetLogger ().WithValues ("kind" , "audio" )
260-
261259 e .trackStatsGatherer = statsGatherer .RegisterTrackStats (stats .OutputAudio )
262260
263261 audioConvert , err := gst .NewElement ("audioconvert" )
@@ -356,8 +354,8 @@ func NewAudioOutput(options *livekit.IngressAudioEncodingOptions, outputSync *ut
356354 return e , nil
357355}
358356
359- func newVideoOutput (codec livekit.VideoCodec , outputSync * utils.TrackOutputSynchronizer , isPlayingTooSlow func () bool , eos * eosDispatcher ) (* VideoOutput , error ) {
360- e , err := newOutput (outputSync , isPlayingTooSlow , eos )
357+ func newVideoOutput (codec livekit.VideoCodec , outputSync * utils.TrackOutputSynchronizer , isPlayingTooSlow func () bool , eos * eosDispatcher , log logger. Logger ) (* VideoOutput , error ) {
358+ e , err := newOutput (outputSync , isPlayingTooSlow , eos , log )
361359 if err != nil {
362360 return nil , err
363361 }
@@ -375,8 +373,8 @@ func newVideoOutput(codec livekit.VideoCodec, outputSync *utils.TrackOutputSynch
375373 return o , nil
376374}
377375
378- func newAudioOutput (codec livekit.AudioCodec , outputSync * utils.TrackOutputSynchronizer , isPlayingTooSlow func () bool , eos * eosDispatcher ) (* AudioOutput , error ) {
379- e , err := newOutput (outputSync , isPlayingTooSlow , eos )
376+ func newAudioOutput (codec livekit.AudioCodec , outputSync * utils.TrackOutputSynchronizer , isPlayingTooSlow func () bool , eos * eosDispatcher , log logger. Logger ) (* AudioOutput , error ) {
377+ e , err := newOutput (outputSync , isPlayingTooSlow , eos , log )
380378 if err != nil {
381379 return nil , err
382380 }
@@ -394,18 +392,23 @@ func newAudioOutput(codec livekit.AudioCodec, outputSync *utils.TrackOutputSynch
394392 return o , nil
395393}
396394
397- func newOutput (outputSync * utils.TrackOutputSynchronizer , isPlayingTooSlow func () bool , eos * eosDispatcher ) (* Output , error ) {
395+ func newOutput (outputSync * utils.TrackOutputSynchronizer , isPlayingTooSlow func () bool , eos * eosDispatcher , log logger. Logger ) (* Output , error ) {
398396 sink , err := app .NewAppSink ()
399397 if err != nil {
400398 return nil , err
401399 }
402400
401+ if log == nil {
402+ log = logger .GetLogger ().WithValues ("kind" , "output" )
403+ }
404+
403405 e := & Output {
404406 queue : utils.NewBlockingQueue [* sample ](queueCapacity ),
405407 sink : sink ,
406408 outputSync : outputSync ,
407409 isPlayingTooSlow : isPlayingTooSlow ,
408410 eos : eos ,
411+ logger : log ,
409412 }
410413
411414 if e .eos != nil {
0 commit comments