Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.xiph.org/xiph/opus.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'src/opus_decoder.c')
-rw-r--r--src/opus_decoder.c17
1 files changed, 16 insertions, 1 deletions
diff --git a/src/opus_decoder.c b/src/opus_decoder.c
index ded9c80f..3db3dcba 100644
--- a/src/opus_decoder.c
+++ b/src/opus_decoder.c
@@ -85,7 +85,7 @@ int opus_decode(OpusDecoder *st, const unsigned char *data,
ec_dec dec;
ec_byte_buffer buf;
SKP_SILK_SDK_DecControlStruct DecControl;
- SKP_int16 silk_frame_size;
+ SKP_int32 silk_frame_size;
short pcm_celt[960];
int audiosize;
@@ -126,6 +126,21 @@ int opus_decode(OpusDecoder *st, const unsigned char *data,
if (st->mode != MODE_CELT_ONLY)
{
DecControl.API_sampleRate = st->Fs;
+ DecControl.payloadSize_ms = 1000 * audiosize / st->Fs;
+ if( st->mode == MODE_SILK_ONLY ) {
+ if( st->bandwidth == BANDWIDTH_NARROWBAND ) {
+ DecControl.internalSampleRate = 8000;
+ } else if( st->bandwidth == BANDWIDTH_MEDIUMBAND ) {
+ DecControl.internalSampleRate = 12000;
+ } else if( st->bandwidth == BANDWIDTH_WIDEBAND ) {
+ DecControl.internalSampleRate = 16000;
+ } else {
+ SKP_assert( 0 );
+ }
+ } else {
+ /* Hybrid mode */
+ DecControl.internalSampleRate = 16000;
+ }
/* We Should eventually have to set the bandwidth here */