diff options
author | Uros Majstorovic <majstor@majstor.org> | 2017-08-10 21:02:16 +0200 |
---|---|---|
committer | Uros Majstorovic <majstor@majstor.org> | 2017-08-10 21:02:16 +0200 |
commit | cbba099541d27400ad45083a4b1102b86f9e8dea (patch) | |
tree | e260d7da3d07b4de0e989726917f08d23c55f70d /code/test | |
parent | e9ced8e60689c6f46ac4fc31013b88f4c3f4fa80 (diff) |
rbuffer almost implemented
Diffstat (limited to 'code/test')
-rw-r--r-- | code/test/basic.c | 4 | ||||
-rw-r--r-- | code/test/client.c | 4 | ||||
-rw-r--r-- | code/test/pr_client.c | 4 | ||||
-rw-r--r-- | code/test/stress.c | 2 | ||||
-rw-r--r-- | code/test/voip.c | 8 |
5 files changed, 12 insertions, 10 deletions
diff --git a/code/test/basic.c b/code/test/basic.c index c9f6bd5..809d453 100644 --- a/code/test/basic.c +++ b/code/test/basic.c @@ -26,7 +26,7 @@ ssize_t handle_open_c(ECPConnection *conn, ecp_seq_t sq, unsigned char t, unsign ecp_conn_handle_open(conn, sq, t, p, s); if (s < 0) { printf("OPEN ERR:%ld\n", s); - return 0; + return s; } unsigned char payload[ECP_SIZE_PLD(1000)]; @@ -36,7 +36,7 @@ ssize_t handle_open_c(ECPConnection *conn, ecp_seq_t sq, unsigned char t, unsign ecp_pld_set_type(payload, MTYPE_MSG); strcpy((char *)buf, msg); ssize_t _rv = ecp_send(conn, payload, sizeof(payload)); - return 0; + return s; } ssize_t handle_msg_c(ECPConnection *conn, ecp_seq_t sq, unsigned char t, unsigned char *p, ssize_t s) { diff --git a/code/test/client.c b/code/test/client.c index 6e45df4..1d5dc6c 100644 --- a/code/test/client.c +++ b/code/test/client.c @@ -22,7 +22,7 @@ ssize_t handle_open_c(ECPConnection *conn, ecp_seq_t sq, unsigned char t, unsign ecp_conn_handle_open(conn, sq, t, p, s); if (s < 0) { printf("OPEN ERR:%ld\n", s); - return 0; + return s; } unsigned char payload[ECP_SIZE_PLD(1000)]; @@ -32,7 +32,7 @@ ssize_t handle_open_c(ECPConnection *conn, ecp_seq_t sq, unsigned char t, unsign ecp_pld_set_type(payload, MTYPE_MSG); strcpy((char *)buf, msg); ssize_t _rv = ecp_send(conn, payload, sizeof(payload)); - return 0; + return s; } ssize_t handle_msg_c(ECPConnection *conn, ecp_seq_t sq, unsigned char t, unsigned char *p, ssize_t s) { diff --git a/code/test/pr_client.c b/code/test/pr_client.c index 7b80d6f..d643dd3 100644 --- a/code/test/pr_client.c +++ b/code/test/pr_client.c @@ -26,7 +26,7 @@ ssize_t handle_open(ECPConnection *conn, ecp_seq_t sq, unsigned char t, unsigned ecp_conn_handle_open(conn, sq, t, p, s); if (s < 0) { printf("OPEN ERR:%ld\n", s); - return 0; + return s; } printf("OPEN!\n"); @@ -38,7 +38,7 @@ ssize_t handle_open(ECPConnection *conn, ecp_seq_t sq, unsigned char t, unsigned ecp_pld_set_type(payload, MTYPE_MSG); strcpy((char *)buf, msg); ssize_t _rv = ecp_send(conn, payload, sizeof(payload)); - return 0; + return s; } ssize_t handle_msg(ECPConnection *conn, ecp_seq_t sq, unsigned char t, unsigned char *p, ssize_t s) { diff --git a/code/test/stress.c b/code/test/stress.c index 42663fc..081c0cb 100644 --- a/code/test/stress.c +++ b/code/test/stress.c @@ -107,7 +107,7 @@ ssize_t handle_open_c(ECPConnection *conn, ecp_seq_t sq, unsigned char t, unsign perror(msg); exit(1); } - return 0; + return s; } ssize_t handle_msg_c(ECPConnection *conn, ecp_seq_t sq, unsigned char t, unsigned char *p, ssize_t s) { diff --git a/code/test/voip.c b/code/test/voip.c index 67e1afe..8c53d01 100644 --- a/code/test/voip.c +++ b/code/test/voip.c @@ -52,7 +52,7 @@ int a_open(char *dev_name, snd_pcm_t **handle, snd_pcm_hw_params_t **hw_params, frame_size = *nchannels * (bits / 8); *buf_size = frame_size * *frames; - return 0; + return ECP_OK; } int a_prepare(snd_pcm_t *handle, snd_pcm_hw_params_t *hw_params, unsigned char *buf, snd_pcm_uframes_t frames) { @@ -68,7 +68,7 @@ int a_prepare(snd_pcm_t *handle, snd_pcm_hw_params_t *hw_params, unsigned char * for (i=0; i<fragments; i++) snd_pcm_writei(handle, buf, frames); } - return 0; + return ECP_OK; } opus_int32 a_read(snd_pcm_t *handle, unsigned char *buf, snd_pcm_uframes_t frames, OpusEncoder *enc, unsigned char *opus_buf, opus_int32 opus_size) { @@ -121,6 +121,8 @@ int a_init(void) { size = opus_decoder_get_size(nchannels); opus_dec = malloc(size); opus_decoder_init(opus_dec, sample_rate, nchannels); + + return ECP_OK; } ssize_t handle_open_c(ECPConnection *conn, ecp_seq_t sq, unsigned char t, unsigned char *p, ssize_t s) { @@ -129,7 +131,7 @@ ssize_t handle_open_c(ECPConnection *conn, ecp_seq_t sq, unsigned char t, unsign ecp_conn_handle_open(conn, t, p, s); if (s < 0) { printf("OPEN ERR:%ld\n", s); - return 0; + return s; } a_init(); |