Open audio device for call (headset) after everything is prepared
It is not allowed to stall after trigger reading of audio device.
This commit is contained in:
parent
8cb0187133
commit
5026e161aa
|
@ -181,8 +181,10 @@ typedef struct call {
|
|||
int disc_cause; /* cause that has been sent by transceiver instance for release */
|
||||
char station_id[16];
|
||||
char dialing[16];
|
||||
char audiodev[64]; /* headphone interface, if used */
|
||||
int samplerate; /* sample rate of headphone interface */
|
||||
void *sound; /* headphone interface */
|
||||
int latspl; /* sample latency at sound interface */
|
||||
int latspl; /* sample latency at headphone interface */
|
||||
samplerate_t srstate; /* patterns/announcement upsampling */
|
||||
jitter_t dejitter; /* headphone audio dejittering */
|
||||
int audio_pos; /* position when playing patterns */
|
||||
|
@ -486,6 +488,8 @@ int call_init(const char *station_id, const char *audiodev, int samplerate, int
|
|||
call.use_mncc_sock = use_mncc_sock;
|
||||
call.send_patterns = send_patterns;
|
||||
call.release_on_disconnect = release_on_disconnect;
|
||||
call.samplerate = samplerate;
|
||||
strncpy(call.audiodev, audiodev, sizeof(call.audiodev) - 1);
|
||||
|
||||
if (call.use_mncc_sock)
|
||||
return 0;
|
||||
|
@ -493,16 +497,6 @@ int call_init(const char *station_id, const char *audiodev, int samplerate, int
|
|||
if (!audiodev[0])
|
||||
return 0;
|
||||
|
||||
/* open sound device for call control */
|
||||
/* use +3.17 dBm0 (factor 1.44) for complete range of sound card */
|
||||
call.sound = sound_open(audiodev, NULL, NULL, 1, 0.0, samplerate, 1.44, 4000.0);
|
||||
if (!call.sound) {
|
||||
PDEBUG(DSENDER, DEBUG_ERROR, "No sound device!\n");
|
||||
|
||||
rc = -EIO;
|
||||
goto error;
|
||||
}
|
||||
|
||||
rc = init_samplerate(&call.srstate, samplerate);
|
||||
if (rc < 0) {
|
||||
PDEBUG(DSENDER, DEBUG_ERROR, "Failed to init sample rate conversion!\n");
|
||||
|
@ -522,6 +516,22 @@ error:
|
|||
return rc;
|
||||
}
|
||||
|
||||
int call_open_audio(void)
|
||||
{
|
||||
if (!call.audiodev[0])
|
||||
return 0;
|
||||
|
||||
/* open sound device for call control */
|
||||
/* use factor 1.4 of speech level for complete range of sound card */
|
||||
call.sound = sound_open(call.audiodev, NULL, NULL, 1, 0.0, call.samplerate, 1.4, 4000.0);
|
||||
if (!call.sound) {
|
||||
PDEBUG(DSENDER, DEBUG_ERROR, "No sound device!\n");
|
||||
return -EIO;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void call_cleanup(void)
|
||||
{
|
||||
if (call.use_mncc_sock)
|
||||
|
|
|
@ -11,6 +11,7 @@ enum number_type {
|
|||
|
||||
int call_init(const char *station_id, const char *audiodev, int samplerate, int latency, int dial_digits, int loopback, int use_mncc_sock, int send_patterns, int release_on_disconnect);
|
||||
void call_cleanup(void);
|
||||
int call_open_audio(void);
|
||||
void process_call(int c);
|
||||
void clear_console_text(void);
|
||||
void print_console_text(void);
|
||||
|
|
|
@ -435,6 +435,10 @@ void main_common(int *quit, int latency, int interval, void (*myhandler)(void))
|
|||
if (sender_open_audio())
|
||||
return;
|
||||
|
||||
/* afterwards open call audio, because we cannot wait for SDR to open */
|
||||
if (call_open_audio())
|
||||
return;
|
||||
|
||||
/* real time priority */
|
||||
if (rt_prio > 0) {
|
||||
struct sched_param schedp;
|
||||
|
|
Loading…
Reference in New Issue