From ae40ff27c8604cc87ea02bf74dc294eaac0f62b2 Mon Sep 17 00:00:00 2001 From: Jay Sorg Date: Sun, 7 Jul 2019 22:05:46 -0700 Subject: [PATCH] chansrv: audin close should chose channel --- sesman/chansrv/audin.c | 37 ++++++++++++++++++++++++++++++++++--- sesman/chansrv/audin.h | 6 ++++++ 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/sesman/chansrv/audin.c b/sesman/chansrv/audin.c index 98eda69e..cb0da874 100644 --- a/sesman/chansrv/audin.c +++ b/sesman/chansrv/audin.c @@ -369,6 +369,10 @@ static int audin_close_response(int chan_id) { LOG(0, ("audin_close_response:")); + g_audio_chanid = 0; + cleanup_client_formats(); + free_stream(g_in_s); + g_in_s = NULL; return 0; } @@ -437,8 +441,6 @@ audin_data(int chan_id, char *data, int bytes) int audin_init(void) { - int error; - LOG(0, ("audin_init:")); g_memset(&g_audin_info, 0, sizeof(g_audin_info)); g_audin_info.open_response = audin_open_response; @@ -447,9 +449,38 @@ audin_init(void) g_audin_info.data = audin_data; g_audio_chanid = 0; g_in_s = NULL; + return 0; +} + +/*****************************************************************************/ +int +audin_deinit(void) +{ + return 0; +} + +/*****************************************************************************/ +int +audin_start(void) +{ + int error; + + LOG(0, ("audin_start:")); + if (g_audio_chanid != 0) + { + return 1; + } error = chansrv_drdynvc_open(AUDIN_NAME, AUDIN_FLAGS, &g_audin_info, /* callback functions */ &g_audio_chanid); /* chansrv chan_id */ - LOG(0, ("audin_init: error %d", error)); + LOG(0, ("audin_start: error %d", error)); return error; } + +/*****************************************************************************/ +int +audin_stop(void) +{ + chansrv_drdynvc_close(g_audio_chanid); + return 0; +} diff --git a/sesman/chansrv/audin.h b/sesman/chansrv/audin.h index d13efd08..7569bc4f 100644 --- a/sesman/chansrv/audin.h +++ b/sesman/chansrv/audin.h @@ -24,5 +24,11 @@ int audin_init(void); +int +audin_deinit(void); +int +audin_start(void); +int +audin_stop(void); #endif