@@ -1470,6 +1470,26 @@ SBC_EXPORT size_t sbc_get_codesize(const sbc_t *sbc)
return subbands * blocks * channels * 2;
}
+SBC_EXPORT unsigned sbc_get_delay(const sbc_t *sbc)
+{
+ uint16_t subbands;
+ struct sbc_priv *priv;
+
+ priv = sbc->priv;
+ if (!priv->init) {
+ subbands = sbc->subbands ? 8 : 4;
+ } else {
+ subbands = priv->frame.subbands;
+ }
+
+ /*
+ * The delay is caused by the processing function which analyzes
+ * old samples to encode the current frame. The amount of that
+ * samples depends on the number of subbands.
+ */
+ return subbands * 9 + 1;
+}
+
SBC_EXPORT const char *sbc_get_implementation_info(const sbc_t *sbc)
{
struct sbc_priv *priv;
@@ -94,6 +94,9 @@ unsigned sbc_get_frame_duration(const sbc_t *sbc);
/* Returns the uncompressed block size in bytes */
size_t sbc_get_codesize(const sbc_t *sbc);
+/* Returns the delay introduced by the codec in frames */
+unsigned sbc_get_delay(const sbc_t *sbc);
+
const char *sbc_get_implementation_info(const sbc_t *sbc);
void sbc_finish(sbc_t *sbc);