Commit 47731b1f authored by Francisco Cabrera Fernandez's avatar Francisco Cabrera Fernandez
Browse files

hola belu

parent 16f15dbb
......@@ -54,6 +54,7 @@ int main(void)
//primitiva LISTEN
listen(server_socketTCP, MAX_QUEUE); //si hay mas de 20 encolados, se descartan las solicitudes nuevas
if (server_socketTCP == -1){
......@@ -112,7 +113,7 @@ void controlVideo(int socket_to_clientTCP,int id_cliente, int &comunicacion[], M
bool inicializado = false;
if (int pthread_create(&hilo_stream, NULL, streamVideo(id_cliente, frame, cap, encoded, comunicacion, pausa, finalizar, client_addr, client_addr_size, inicializado), NULL) != 0) perror("No se pudo enviar el video");//separo thread (idcliente, udp)
int aux = 1;
char data;
while (aux != 5){
//primitiva RECEIVE
......@@ -130,10 +131,13 @@ void controlVideo(int socket_to_clientTCP,int id_cliente, int &comunicacion[], M
case 4:
pthread_mutex_lock(&finalizar);
break;
case 5:
pthread_cancel(hilo_stream);
break;
}
pthread_mutex_lock(&mutex);
int aux = comunicacion[id_cliente];
aux = comunicacion[id_cliente];
pthread_mutex_unlock(&mutex);
}
pthread_join(hilo_stream, NULL);
......@@ -151,6 +155,8 @@ void streamVideo(int id_cliente, Mat frame, VideoCapture cap, vector<uchar> enco
pthread_mutex_lock(&mutex);
int aux = comunicacion[id_cliente];
pthread_mutex_unlock(&mutex);
int tamaño_frame;
int tamaño_video = sizeof(cap);
while ( aux != SALIR) { //MIRAR ESTO PARA CORREGIR
......@@ -175,6 +181,13 @@ void streamVideo(int id_cliente, Mat frame, VideoCapture cap, vector<uchar> enco
(struct sockaddr*)& client_addr, client_addr_size
);
tamaño_frame += sizeof(frame);
if (tamaño_frame == tamaño_video){
pthread_mutex_lock(&mutex);
int aux = comunicacion[id_cliente] = 4;
pthread_mutex_unlock(&mutex);
}
pthread_mutex_lock(&mutex);
int aux = comunicacion[id_cliente];
pthread_mutex_unlock(&mutex);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment