Fixed loopback test mode
This commit is contained in:
parent
d88ef1a645
commit
be5d5e24f8
|
@ -38,6 +38,7 @@ static const char *name = "alsa";
|
|||
static const char *audiodev = NULL;
|
||||
static int samplerate = 48000;
|
||||
static int latency = 50;
|
||||
static int loopback = 0;
|
||||
static int tx_delay = 0;
|
||||
static int rt_prio = 1;
|
||||
static const char *caller_id = "";
|
||||
|
@ -81,6 +82,9 @@ static void print_help()
|
|||
printf(" Give a delay in milliseconds. This is required for modem/fax. Audio\n");
|
||||
printf(" toward ISDN interface is buffered with the given delay.\n");
|
||||
printf(" This feature alters dejittering strategy.\n");
|
||||
printf(" -l --loopback 3\n");
|
||||
printf(" Use value 3 to loop audio from ALSA back to ALSA. Only works during a\n");
|
||||
printf(" call.\n");
|
||||
printf(" -r --realtime <prio>\n");
|
||||
printf(" Set prio: 0 to disable, 99 for maximum (default = %d)\n", rt_prio);
|
||||
printf(" -C --cc \"<osmo-cc arg>\" [--cc ...]\n");
|
||||
|
@ -101,6 +105,7 @@ static void add_options(void)
|
|||
option_add('s', "samplerate", 1);
|
||||
option_add('b', "buffer", 1);
|
||||
option_add(OPT_TX_DELAY, "tx-delay", 1);
|
||||
option_add('l', "loopback", 1);
|
||||
option_add('r', "realtime", 1);
|
||||
option_add('C', "cc", 1);
|
||||
}
|
||||
|
@ -163,6 +168,9 @@ static int handle_options(int short_option, int argi, char **argv)
|
|||
case OPT_TX_DELAY:
|
||||
tx_delay = atoi(argv[argi]);
|
||||
break;
|
||||
case 'l':
|
||||
loopback = atoi(argv[argi]);
|
||||
break;
|
||||
case 'r':
|
||||
rt_prio = atoi(argv[argi]);
|
||||
break;
|
||||
|
@ -244,7 +252,7 @@ int main(int argc, char *argv[])
|
|||
goto error;
|
||||
}
|
||||
|
||||
rc = telephone_init(telephone_ep, name, caller_id, OSMO_CC_LOCATION_USER, early_audio, audiodev, samplerate, samplerate * latency / 1000, tx_delay);
|
||||
rc = telephone_init(telephone_ep, name, caller_id, OSMO_CC_LOCATION_USER, early_audio, audiodev, samplerate, samplerate * latency / 1000, tx_delay, loopback);
|
||||
if (rc) {
|
||||
PDEBUG(DTEL, DEBUG_ERROR, "Endpoint initializing failed!\n");
|
||||
goto error;
|
||||
|
|
|
@ -139,7 +139,7 @@ void telephone_destroy(telephone_t *telephone_ep)
|
|||
}
|
||||
|
||||
/* initialization and configuration of interface instance */
|
||||
int telephone_init(telephone_t *telephone_ep, const char *name, const char *callerid, uint8_t serving_location, int early_audio, const char *audiodev, int samplerate, int __attribute__((unused)) buffer_size, int tx_delay)
|
||||
int telephone_init(telephone_t *telephone_ep, const char *name, const char *callerid, uint8_t serving_location, int early_audio, const char *audiodev, int samplerate, int __attribute__((unused)) buffer_size, int tx_delay, int loopback)
|
||||
{
|
||||
telephone_ep->name = strdup(name);
|
||||
telephone_ep->serving_location = serving_location;
|
||||
|
@ -147,7 +147,7 @@ int telephone_init(telephone_t *telephone_ep, const char *name, const char *call
|
|||
telephone_ep->samplerate = samplerate;
|
||||
telephone_ep->buffer_size = buffer_size;
|
||||
telephone_ep->tx_delay = tx_delay;
|
||||
telephone_ep->loopback = 0;
|
||||
telephone_ep->loopback = loopback;
|
||||
strcpy(ui_local_id, callerid);
|
||||
|
||||
if (audiodev) {
|
||||
|
@ -338,9 +338,10 @@ void alsa_work(telephone_t *telephone_ep)
|
|||
if (call && count) {
|
||||
int i;
|
||||
|
||||
if (telephone_ep->loopback == 3)
|
||||
jitter_save(&call->tx_dejitter, samples, count, 0, 0, 0, 0);
|
||||
count = samplerate_downsample(&call->srstate, samples, count);
|
||||
if (count && telephone_ep->loopback == 3) {
|
||||
jitter_save(&call->tx_dejitter, samples, count, 0, 0, 0, 0);
|
||||
}
|
||||
/* put samples into ring buffer */
|
||||
for (i = 0; i < count; i++) {
|
||||
call->tx_buffer[call->tx_buffer_pos] = samples[i];
|
||||
|
|
|
@ -68,7 +68,7 @@ typedef struct call_list {
|
|||
|
||||
void telephone_destroy(telephone_t *telephone_ep);
|
||||
telephone_t *telephone_create(void);
|
||||
int telephone_init(telephone_t *telephone_ep, const char *name, const char *callerid, uint8_t serving_location, int early_audio, const char *audiodev, int samplerate, int latspl, int tx_delay);
|
||||
int telephone_init(telephone_t *telephone_ep, const char *name, const char *callerid, uint8_t serving_location, int early_audio, const char *audiodev, int samplerate, int latspl, int tx_delay, int loopback);
|
||||
void cc_message(osmo_cc_endpoint_t *ep, uint32_t callref, osmo_cc_msg_t *msg);
|
||||
int ui_init(const char *remote_id, int autoalert, int autoanswer);
|
||||
int ui_work(telephone_t *telephone_ep, int c);
|
||||
|
|
Loading…
Reference in New Issue