Use blank frames at frame rate (#710)
* 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. * Trying more stuff for DTX * - Use a go routine to send blank frames - Use duration instead of number of frames and calculate number of frames * augment comment * Remove debug * Return a chan from writeBlankFrameRTP * Use a long duration for mute * add comment * Incorporate suggestion from Jie
This commit is contained in:
@@ -5,6 +5,7 @@ import (
|
||||
"math"
|
||||
"strings"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/pion/webrtc/v3"
|
||||
|
||||
@@ -1300,6 +1301,12 @@ func (f *Forwarder) GetSnTsForBlankFrames(frameRate uint32, numPackets int) ([]S
|
||||
f.lock.Lock()
|
||||
defer f.lock.Unlock()
|
||||
|
||||
// NOTE: not using diff of current time and previous packet time (lTSCalc) as this
|
||||
// driven by a timer, there might be slight differences compared to the frame rate.
|
||||
// As the differences are going to be small (and also not to update RTP time stamp
|
||||
// by those small differences), not doing the diff.
|
||||
f.lTSCalc = time.Now().UnixNano()
|
||||
|
||||
frameEndNeeded := !f.rtpMunger.IsOnFrameBoundary()
|
||||
if frameEndNeeded {
|
||||
numPackets++
|
||||
|
||||
Reference in New Issue
Block a user