This commit is contained in:
Your Name 2024-02-28 00:29:34 +03:00
parent 70208183bb
commit 56c5256973
4 changed files with 6 additions and 20 deletions

11
LICENSE
View File

@ -1,11 +0,0 @@
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
Version 2, December 2004
Copyright (C) 2004 Sam Hocevar <sam@hocevar.net>
Everyone is permitted to copy and distribute verbatim or modified copies of this license document, and changing it is allowed as long as the name is changed.
DO WHAT THE FUCK YOU WANT TO PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. You just DO WHAT THE FUCK YOU WANT TO.

View File

@ -1,2 +0,0 @@
# Streamer

View File

@ -2,8 +2,8 @@
#Record audio in sterio
arecord -D loopout -f S16_LE -t raw -r 41000 -c 2 | ./server
arecord -D loopout --buffer-size=20000 -f S16_LE -t raw -r 48000 -c 2 | ./server
#Geting raw pcm data and send to speaker
echo "JOIN" | nc -u server_ip server_port | aplay -r 41000 -f S16_LE -c 2
echo "JOIN" | nc -u server_ip server_port | aplay -r 48000 -f S16_LE -c 2

View File

@ -10,8 +10,8 @@
#include <pthread.h>
#define PORT 8889
#define BUFF_SIZE 3024
#define MAX_CLIENTS 25
#define BUFF_SIZE 8192
#define MAX_CLIENTS 125
typedef struct {
int fd;
@ -20,14 +20,13 @@ typedef struct {
void *process_clients(void *p) {
DATA *data = (DATA *)p;
char buf[BUFF_SIZE + 1];
char buf[BUFF_SIZE];
while (1) {
off_t ret = read(STDIN_FILENO, buf, sizeof(buf));
if (ret <= 0)
continue;
buf[ret - 1] = '\0';
socklen_t len = sizeof(struct sockaddr_in);
for (size_t i = 0; i < MAX_CLIENTS; i++)
sendto(data->fd, buf, ret, 0, (struct sockaddr *)&data->clients[i], len);
@ -41,7 +40,7 @@ int main(void) {
if (fd < 0)
goto ERROR_WITHOUTCLOSE;
struct timeval tv = {.tv_sec = 0, .tv_usec = 512};
struct timeval tv = {.tv_sec = 0, .tv_usec = 50};
if (setsockopt(fd, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) < 0)
goto ERROR;