summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlfred E. Heggestad <aeh@db.org>2015-06-16 21:28:55 +0200
committerAlfred E. Heggestad <aeh@db.org>2015-06-16 21:28:55 +0200
commit55fe148705d206d206f61dd9aa119a6672378e07 (patch)
tree144e4daca0a7c7e85c3582eac4b2f716e7ab92e1
parent3905f6ccd0700b98046015c37cdd9af9eb2550cb (diff)
aubridge: use input samples directly, if resampler is not needed
-rw-r--r--modules/aubridge/aubridge.c20
-rw-r--r--modules/aubridge/device.c30
2 files changed, 39 insertions, 11 deletions
diff --git a/modules/aubridge/aubridge.c b/modules/aubridge/aubridge.c
index 421d903..f1fcfa3 100644
--- a/modules/aubridge/aubridge.c
+++ b/modules/aubridge/aubridge.c
@@ -1,13 +1,31 @@
/**
* @file aubridge.c Audio bridge
*
- * Copyright (C) 2010 Creytiv.com
+ * Copyright (C) 2010 - 2015 Creytiv.com
*/
#include <re.h>
#include <baresip.h>
#include "aubridge.h"
+/**
+ * @defgroup aubridge aubridge
+ *
+ * Audio bridge module
+ *
+ * This module can be used to connect two audio devices together,
+ * so that all output to AUPLAY device is bridged as the input to
+ * a AUSRC device.
+ *
+ * Sample config:
+ *
+ \verbatim
+ audio_player aubridge,pseudo0
+ audio_source aubridge,pseudo0
+ \endverbatim
+ */
+
+
static struct ausrc *ausrc;
static struct auplay *auplay;
diff --git a/modules/aubridge/device.c b/modules/aubridge/device.c
index 2cd9a60..392d8e0 100644
--- a/modules/aubridge/device.c
+++ b/modules/aubridge/device.c
@@ -91,16 +91,26 @@ static void *device_thread(void *arg)
dev->auplay->wh(sampv_in, sampc_in, dev->auplay->arg);
}
- err = auresamp(&rs,
- sampv_out, &sampc_out,
- sampv_in, sampc_in);
- if (err) {
- warning("aubridge: auresamp error: %m\n", err);
+ if (rs.resample) {
+ err = auresamp(&rs,
+ sampv_out, &sampc_out,
+ sampv_in, sampc_in);
+ if (err) {
+ warning("aubridge: auresamp error"
+ " sampc_out=%zu, sampc_in=%zu (%m)\n",
+ sampc_out, sampc_in, err);
+ }
+
+ if (dev->ausrc && dev->ausrc->rh) {
+ dev->ausrc->rh(sampv_out, sampc_out,
+ dev->ausrc->arg);
+ }
}
-
- if (dev->ausrc && dev->ausrc->rh) {
- dev->ausrc->rh(sampv_out, sampc_out,
- dev->ausrc->arg);
+ else {
+ if (dev->ausrc && dev->ausrc->rh) {
+ dev->ausrc->rh(sampv_in, sampc_in,
+ dev->ausrc->arg);
+ }
}
ts += PTIME;
@@ -140,7 +150,7 @@ int device_connect(struct device **devp, const char *device,
*devp = dev;
- debug("aubridge: created device '%s'\n", device);
+ info("aubridge: created device '%s'\n", device);
}
if (auplay)