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
+4 -4
View File
@@ -305,8 +305,8 @@ func TestUpdateAndGetPaddingSnTs(t *testing.T) {
var sntsExpected = make([]SnTs, numPadding)
for i := 0; i < numPadding; i++ {
sntsExpected[i] = SnTs{
sequenceNumber: 23333 + uint16(i) + 1,
timestamp: 0xabcdef + (uint32(i)*clockRate)/frameRate,
sequenceNumber: params.SequenceNumber + uint16(i) + 1,
timestamp: params.Timestamp + (uint32(i)*clockRate)/frameRate,
}
}
snts, err := r.UpdateAndGetPaddingSnTs(numPadding, clockRate, frameRate, true)
@@ -316,8 +316,8 @@ func TestUpdateAndGetPaddingSnTs(t *testing.T) {
// now that there is a marker, timestamp should jump on first padding when asked again
for i := 0; i < numPadding; i++ {
sntsExpected[i] = SnTs{
sequenceNumber: 23343 + uint16(i) + 1,
timestamp: 0xabcdef + (uint32(i+1)*clockRate)/frameRate,
sequenceNumber: params.SequenceNumber + uint16(len(snts)) + uint16(i) + 1,
timestamp: params.Timestamp + (uint32(i+1)*clockRate)/frameRate,
}
}
snts, err = r.UpdateAndGetPaddingSnTs(numPadding, clockRate, frameRate, false)