diff options
author | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2012-09-21 06:00:22 +0400 |
---|---|---|
committer | Jean-Marc Valin <jmvalin@jmvalin.ca> | 2012-09-21 06:04:37 +0400 |
commit | 6b45974fbd3bd8a50f9532680cb89590e150a843 (patch) | |
tree | f4c16696c006ed7f480cf2758c69c42e6863167f /silk | |
parent | ff16ab098e1ffe799f8ea87efc7458fcf0a93371 (diff) |
Reduces rate/max rate to make room for redundancy
This fixes a problem where we could end up starving the redundancy
frame, especially for CBR. The solution is to make sure that some
bits are left available -- assuming we use the same rate for redundancy
as for the rest of the frame.
Diffstat (limited to 'silk')
-rw-r--r-- | silk/control_audio_bandwidth.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/silk/control_audio_bandwidth.c b/silk/control_audio_bandwidth.c index a9af9134..b645dd57 100644 --- a/silk/control_audio_bandwidth.c +++ b/silk/control_audio_bandwidth.c @@ -80,6 +80,8 @@ opus_int silk_control_audio_bandwidth( } else { if( psEncC->sLP.transition_frame_no <= 0 ) { encControl->switchReady = 1; + /* Make room for redundancy */ + encControl->maxBits -= encControl->maxBits * 5 / ( encControl->payloadSize_ms + 5 ); } else { /* Direction: down (at double speed) */ psEncC->sLP.mode = -2; @@ -106,6 +108,8 @@ opus_int silk_control_audio_bandwidth( } else { if( psEncC->sLP.mode == 0 ) { encControl->switchReady = 1; + /* Make room for redundancy */ + encControl->maxBits -= encControl->maxBits * 5 / ( encControl->payloadSize_ms + 5 ); } else { /* Direction: up */ psEncC->sLP.mode = 1; |