@@ -451,6 +451,7 @@ func (s *Capture) SetV2() {
451
451
enableLegacy = true
452
452
}
453
453
454
+ modifiedVideoCodec := false
454
455
if videoCodec := viper .GetString ("video_codec" ); videoCodec != "" {
455
456
s .VideoCodec , ok = codec .ParseStr (videoCodec )
456
457
if ! ok || s .VideoCodec .Type != webrtc .RTPCodecTypeVideo {
@@ -459,24 +460,29 @@ func (s *Capture) SetV2() {
459
460
}
460
461
log .Warn ().Msg ("you are using v2 configuration 'NEKO_VIDEO_CODEC' which is deprecated, please use 'NEKO_CAPTURE_VIDEO_CODEC' instead" )
461
462
enableLegacy = true
463
+ modifiedVideoCodec = true
462
464
}
463
465
464
466
if viper .GetBool ("vp8" ) {
465
467
s .VideoCodec = codec .VP8 ()
466
468
log .Warn ().Msg ("you are using deprecated config setting 'NEKO_VP8=true', use 'NEKO_CAPTURE_VIDEO_CODEC=vp8' instead" )
467
469
enableLegacy = true
470
+ modifiedVideoCodec = true
468
471
} else if viper .GetBool ("vp9" ) {
469
472
s .VideoCodec = codec .VP9 ()
470
473
log .Warn ().Msg ("you are using deprecated config setting 'NEKO_VP9=true', use 'NEKO_CAPTURE_VIDEO_CODEC=vp9' instead" )
471
474
enableLegacy = true
475
+ modifiedVideoCodec = true
472
476
} else if viper .GetBool ("h264" ) {
473
477
s .VideoCodec = codec .H264 ()
474
478
log .Warn ().Msg ("you are using deprecated config setting 'NEKO_H264=true', use 'NEKO_CAPTURE_VIDEO_CODEC=h264' instead" )
475
479
enableLegacy = true
480
+ modifiedVideoCodec = true
476
481
} else if viper .GetBool ("av1" ) {
477
482
s .VideoCodec = codec .AV1 ()
478
483
log .Warn ().Msg ("you are using deprecated config setting 'NEKO_AV1=true', use 'NEKO_CAPTURE_VIDEO_CODEC=av1' instead" )
479
484
enableLegacy = true
485
+ modifiedVideoCodec = true
480
486
}
481
487
482
488
videoHWEnc := HwEncUnset
@@ -498,7 +504,7 @@ func (s *Capture) SetV2() {
498
504
videoPipeline := viper .GetString ("video" )
499
505
500
506
// video pipeline
501
- if videoHWEnc != HwEncUnset || videoBitrate != 0 || videoMaxFPS != 0 || videoPipeline != "" {
507
+ if modifiedVideoCodec || videoHWEnc != HwEncUnset || videoBitrate != 0 || videoMaxFPS != 0 || videoPipeline != "" {
502
508
pipeline , err := NewVideoPipeline (s .VideoCodec , s .Display , videoPipeline , videoMaxFPS , videoBitrate , videoHWEnc )
503
509
if err != nil {
504
510
log .Warn ().Err (err ).Msg ("unable to create video pipeline, using default" )
@@ -534,6 +540,7 @@ func (s *Capture) SetV2() {
534
540
enableLegacy = true
535
541
}
536
542
543
+ modifiedAudioCodec := false
537
544
if audioCodec := viper .GetString ("audio_codec" ); audioCodec != "" {
538
545
s .AudioCodec , ok = codec .ParseStr (audioCodec )
539
546
if ! ok || s .AudioCodec .Type != webrtc .RTPCodecTypeAudio {
@@ -542,31 +549,36 @@ func (s *Capture) SetV2() {
542
549
}
543
550
log .Warn ().Msg ("you are using v2 configuration 'NEKO_AUDIO_CODEC' which is deprecated, please use 'NEKO_CAPTURE_AUDIO_CODEC' instead" )
544
551
enableLegacy = true
552
+ modifiedAudioCodec = true
545
553
}
546
554
547
555
if viper .GetBool ("opus" ) {
548
556
s .AudioCodec = codec .Opus ()
549
557
log .Warn ().Msg ("you are using deprecated config setting 'NEKO_OPUS=true', use 'NEKO_CAPTURE_AUDIO_CODEC=opus' instead" )
550
558
enableLegacy = true
559
+ modifiedAudioCodec = true
551
560
} else if viper .GetBool ("g722" ) {
552
561
s .AudioCodec = codec .G722 ()
553
562
log .Warn ().Msg ("you are using deprecated config setting 'NEKO_G722=true', use 'NEKO_CAPTURE_AUDIO_CODEC=g722' instead" )
554
563
enableLegacy = true
564
+ modifiedAudioCodec = true
555
565
} else if viper .GetBool ("pcmu" ) {
556
566
s .AudioCodec = codec .PCMU ()
557
567
log .Warn ().Msg ("you are using deprecated config setting 'NEKO_PCMU=true', use 'NEKO_CAPTURE_AUDIO_CODEC=pcmu' instead" )
558
568
enableLegacy = true
569
+ modifiedAudioCodec = true
559
570
} else if viper .GetBool ("pcma" ) {
560
571
s .AudioCodec = codec .PCMA ()
561
572
log .Warn ().Msg ("you are using deprecated config setting 'NEKO_PCMA=true', use 'NEKO_CAPTURE_AUDIO_CODEC=pcma' instead" )
562
573
enableLegacy = true
574
+ modifiedAudioCodec = true
563
575
}
564
576
565
577
audioBitrate := viper .GetUint ("audio_bitrate" )
566
578
audioPipeline := viper .GetString ("audio" )
567
579
568
580
// audio pipeline
569
- if audioBitrate != 0 || audioPipeline != "" {
581
+ if modifiedAudioCodec || audioBitrate != 0 || audioPipeline != "" {
570
582
pipeline , err := NewAudioPipeline (s .AudioCodec , s .AudioDevice , audioPipeline , audioBitrate )
571
583
if err != nil {
572
584
log .Warn ().Err (err ).Msg ("unable to create audio pipeline, using default" )
0 commit comments