diff --git a/silk b/silk
index 6c98e344f395b3d1a285885a8be88c0685a346b2..d513d743fb5d9802e2d39d74a13f5628c1553059 160000
--- a/silk
+++ b/silk
@@ -1 +1 @@
-Subproject commit 6c98e344f395b3d1a285885a8be88c0685a346b2
+Subproject commit d513d743fb5d9802e2d39d74a13f5628c1553059
diff --git a/src/opus_decoder.c b/src/opus_decoder.c
index ded9c80f3ea1dcee230c7744cb2228026621f491..3db3dcba6b143aa5c3c66bfcdff698f25e6e6733 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 */
 
diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index 60933d7d5fbffb43f32bee7cf666ee3623cff06d..f66b189bea1369ec1f10b3eff5be573398368855 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -92,7 +92,7 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
 {
     int i;
 	int ret=0;
-	SKP_int16 nBytes;
+	SKP_int32 nBytes;
 	ec_enc enc;
 	ec_byte_buffer buf;
 	SKP_SILK_SDK_EncControlStruct encControl;
@@ -119,20 +119,25 @@ int opus_encode(OpusEncoder *st, const short *pcm, int frame_size,
 	        if (st->Fs  == 100 * frame_size)
 	            encControl.bitRate -= 5000;
 	    }
-	    encControl.packetSize = frame_size;
+            encControl.payloadSize_ms = 1000 * frame_size / st->Fs;
+
+            if (st->mode == MODE_HYBRID)
+               encControl.minInternalSampleRate = 16000;
+            else
+               encControl.minInternalSampleRate = 8000;
 
 	    if (st->bandwidth == BANDWIDTH_NARROWBAND)
 	        encControl.maxInternalSampleRate = 8000;
 	    else if (st->bandwidth == BANDWIDTH_MEDIUMBAND)
-            encControl.maxInternalSampleRate = 12000;
+               encControl.maxInternalSampleRate = 12000;
 	    else
-	        encControl.maxInternalSampleRate = 16000;
+               encControl.maxInternalSampleRate = 16000;
 
 	    /* Call SILK encoder for the low band */
 	    nBytes = bytes_per_packet;
 	    ret = SKP_Silk_SDK_Encode( st->silk_enc, &encControl, pcm, frame_size, &enc, &nBytes );
 	    if( ret ) {
-	        fprintf (stderr, "SILK encode error\n");
+	        fprintf (stderr, "SILK encode error %d\n", ret);
 	        /* Handle error */
 	    }
 	    ret = (ec_enc_tell(&enc, 0)+7)>>3;