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:
@@ -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
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user