shithub: libopusenc

Download patch

ref: 51fc441fcdf5d97f15b73bccac45bb5fcf7f78f1
parent: 1f4bc1dcc6039e786c721adbfd82e7033cd667f5
author: Jean-Marc Valin <jmvalin@jmvalin.ca>
date: Mon May 1 12:19:13 EDT 2017

Frame size support (untested)

--- a/src/opusenc.c
+++ b/src/opusenc.c
@@ -470,6 +470,26 @@
       ret = opus_multistream_encoder_ctl(enc->st, request, value);
     }
     break;
+    case OPUS_SET_EXPERT_FRAME_DURATION_REQUEST:
+    {
+      opus_int32 value = va_arg(ap, opus_int32);
+      int max_supported = OPUS_FRAMESIZE_60_MS;
+#ifdef OPUS_FRAMESIZE_120_MS
+      max_supported = OPUS_FRAMESIZE_120_MS;
+#endif
+      if (value < OPUS_FRAMESIZE_2_5_MS || value > max_supported) {
+        ret = OPE_UNIMPLEMENTED;
+        break;
+      }
+      ret = opus_multistream_encoder_ctl(enc->st, request, value);
+      if (ret == OPUS_OK) {
+        if (value <= OPUS_FRAMESIZE_40_MS)
+          enc->frame_size = 120<<(value-OPUS_FRAMESIZE_2_5_MS);
+        else
+          enc->frame_size = (value-OPUS_FRAMESIZE_2_5_MS-2)*960;
+      }
+    }
+    break;
     default:
       ret = OPE_UNIMPLEMENTED;
   }