Inject silence opus frames on mute (#682)

* Inject silence opus frames on mute.

If not, under certain circumstances, residual noise
seems to trigger comfort noise generation at the decoder
which is not all that comfortable.

* inject silence only when muting

* Add comment

* augment comment

* Delete blank line

* Adjust TS offset on blank frames

* Remove debug

* Do not modify `lastTS` as it affects timestamp on next switch.

* use duration to calculate number of blank frames

* log errors in blank frames write path
This commit is contained in:
Raja Subramanian
2022-05-15 11:29:40 +05:30
committed by GitHub
parent fa53da18e7
commit d828e0fbd8
4 changed files with 90 additions and 33 deletions
+3 -4
View File
@@ -1268,16 +1268,15 @@ func (f *Forwarder) GetSnTsForPadding(num int) ([]SnTs, error) {
return f.rtpMunger.UpdateAndGetPaddingSnTs(num, 0, 0, forceMarker)
}
func (f *Forwarder) GetSnTsForBlankFrames() ([]SnTs, bool, error) {
func (f *Forwarder) GetSnTsForBlankFrames(frameRate uint32, numPackets int) ([]SnTs, bool, error) {
f.lock.Lock()
defer f.lock.Unlock()
num := RTPBlankFramesMax
frameEndNeeded := !f.rtpMunger.IsOnFrameBoundary()
if frameEndNeeded {
num++
numPackets++
}
snts, err := f.rtpMunger.UpdateAndGetPaddingSnTs(num, f.codec.ClockRate, 30, frameEndNeeded)
snts, err := f.rtpMunger.UpdateAndGetPaddingSnTs(numPackets, f.codec.ClockRate, frameRate, frameEndNeeded)
return snts, frameEndNeeded, err
}