Set up audio config in audio level module when config is updated. (#4290)

* Set up audio config in audio level module when config is updated.

It is possible to get audio config after bind (bind is where the audio
level module is created) for remote tracks. So, split out setting audio
level config in audio level module and invoke it when config is updated.

* coderabbit review

* prevent divide-by-0

* not active before config
This commit is contained in:
Raja Subramanian
2026-02-05 09:35:26 +05:30
committed by GitHub
parent f3e9b68854
commit 370e0a4d52
3 changed files with 40 additions and 20 deletions
+7 -6
View File
@@ -126,14 +126,15 @@ func TestAudioLevel(t *testing.T) {
}
func createAudioLevel(activeLevel uint8, minPercentile uint8, observeDuration uint32) *AudioLevel {
return NewAudioLevel(AudioLevelParams{
Config: AudioLevelConfig{
ActiveLevel: activeLevel,
MinPercentile: minPercentile,
UpdateInterval: observeDuration,
},
al := NewAudioLevel(AudioLevelParams{
ClockRate: 48000,
})
al.SetConfig(AudioLevelConfig{
ActiveLevel: activeLevel,
MinPercentile: minPercentile,
UpdateInterval: observeDuration,
})
return al
}
func observeSamples(a *AudioLevel, level uint8, count int, baseTime time.Time) {