Rework silence interpolation to work around duplicated silence problem. #61
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The duplicated silence problem is an artefact of some soft 'phones that exist in the wild.
The scenario is a soft 'phone being put on hold and taken off hold by the other end. These particular soft 'phones sometimes end up sending two RTP packets as follows when they come off hold.
An actual receiving UA drops the first, delayed-arrival, audio; and the silence is implicit. extractaudio tries to do silence interpolation to sort-of match this (to the extent that it can, given that it doesn't discard audio). But it has two triggers for interpolated silence which are both triggered in this scenario. One trigger is the delayed arrival of old-timestamped audio. Another trigger is the gap in the timestamps. This ends up effectively doubling the silence period in the output audio file. (Heartbeats have some slight effect on this, and also result in timestamps decreasing if the hold period is longer than 800 seconds.)
This rework adjusts the silence interpolation as follows: