Updates opus_demo
diff --git a/src/opus_demo.c b/src/opus_demo.c
index a448065..a0acb0c 100644
--- a/src/opus_demo.c
+++ b/src/opus_demo.c
@@ -245,6 +245,7 @@
     int nb_encoded;
     int remaining=0;
     int variable_duration=OPUS_FRAMESIZE_ARG;
+    int delayed_decision=0;
 
     if (argc < 5 )
     {
@@ -313,7 +314,7 @@
     forcechannels = OPUS_AUTO;
     use_dtx = 0;
     packet_loss_perc = 0;
-    max_frame_size = 48000;
+    max_frame_size = 2*48000;
     curr_read=0;
 
     while( args < argc - 2 ) {
@@ -385,6 +386,10 @@
             check_encoder_option(decode_only, "-variable-duration");
             variable_duration = OPUS_FRAMESIZE_VARIABLE;
             args++;
+        } else if( strcmp( argv[ args ], "-delayed-decision" ) == 0 ) {
+            check_encoder_option(decode_only, "-delayed-decision");
+            delayed_decision = 1;
+            args++;
         } else if( strcmp( argv[ args ], "-dtx") == 0 ) {
             check_encoder_option(decode_only, "-dtx");
             use_dtx = 1;
@@ -566,7 +571,26 @@
     if ( use_inbandfec ) {
         data[1] = (unsigned char*)calloc(max_payload_bytes,sizeof(char));
     }
-    frame_size = 48000;
+    if(delayed_decision)
+    {
+       if (variable_duration!=OPUS_FRAMESIZE_VARIABLE)
+       {
+          if (frame_size==sampling_rate/400)
+             variable_duration = OPUS_FRAMESIZE_2_5_MS;
+          else if (frame_size==sampling_rate/200)
+             variable_duration = OPUS_FRAMESIZE_5_MS;
+          else if (frame_size==sampling_rate/100)
+             variable_duration = OPUS_FRAMESIZE_10_MS;
+          else if (frame_size==sampling_rate/50)
+             variable_duration = OPUS_FRAMESIZE_20_MS;
+          else if (frame_size==sampling_rate/25)
+             variable_duration = OPUS_FRAMESIZE_40_MS;
+          else
+             variable_duration = OPUS_FRAMESIZE_60_MS;
+          opus_encoder_ctl(enc, OPUS_SET_EXPERT_FRAME_DURATION(variable_duration));
+       }
+       frame_size = 2*48000;
+    }
     while (!stop)
     {
         if (delayed_celt)
diff --git a/src/opus_encoder.c b/src/opus_encoder.c
index f189689..3cee88b 100644
--- a/src/opus_encoder.c
+++ b/src/opus_encoder.c
@@ -776,7 +776,7 @@
       new_size = IMAX(3*Fs/50, (Fs/400)<<(variable_duration-OPUS_FRAMESIZE_2_5_MS));
    else
       return -1;
-   if (new_size<frame_size)
+   if (new_size>frame_size)
       return -1;
    if (400*new_size!=Fs && 200*new_size!=Fs && 100*new_size!=Fs &&
             50*new_size!=Fs && 25*new_size!=Fs && 50*new_size!=3*Fs)