Enhancement: audio speakers (#44)

* refactor: active speakers

1. Observe the loudest adjusted with active ratio instead of linear average of decibel values
2. Follow RFC6465 to convert audio level from decibel to linear value.
3. Quantize audio level for stable slice comparison
4. Switch moving average algorithm from MMA to EMA to have the same center of mass with SMA
5. Minor: remove seenSids map allocation
6. Minor: minimize division arithmetic

* Update pkg/rtc/audiolevel.go

Co-authored-by: David Zhao <david@davidzhao.com>
This commit is contained in:
hn8andDavid Zhao authored and GitHub committed 2021-07-09 09:46:24 -07:00
1 parent 1fd858a16b
commit dcfe7eaf4f
12 files changed
+103 -86

No files matched your search

-2
View File
@@ -23,7 +23,6 @@ type TrackWriter struct {
track *webrtc.TrackLocalStaticSample
filePath string
mime string
done chan bool
ogg *oggreader.OggReader
ivfheader *ivfreader.IVFFileHeader
@@ -39,7 +38,6 @@ func NewTrackWriter(ctx context.Context, track *webrtc.TrackLocalStaticSample, f
track: track,
filePath: filePath,
mime: track.Codec().MimeType,
done: make(chan bool),
}
}