Free up resources allocated for audio when client connection is closed
This commit is contained in:
parent
b63e14c274
commit
ea8feac587
@ -39,6 +39,7 @@
|
|||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <time.h>
|
#include <time.h>
|
||||||
#include <iconv.h>
|
#include <iconv.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
|
||||||
#include <rfb/rfbclient.h>
|
#include <rfb/rfbclient.h>
|
||||||
|
|
||||||
@ -46,6 +47,7 @@
|
|||||||
|
|
||||||
#include "client.h"
|
#include "client.h"
|
||||||
#include "convert.h"
|
#include "convert.h"
|
||||||
|
#include "pa_handlers.h"
|
||||||
|
|
||||||
int vnc_guac_client_handle_messages(guac_client* client) {
|
int vnc_guac_client_handle_messages(guac_client* client) {
|
||||||
|
|
||||||
@ -124,6 +126,20 @@ int vnc_guac_client_free_handler(guac_client* client) {
|
|||||||
vnc_guac_client_data* guac_client_data = (vnc_guac_client_data*) client->data;
|
vnc_guac_client_data* guac_client_data = (vnc_guac_client_data*) client->data;
|
||||||
rfbClient* rfb_client = guac_client_data->rfb_client;
|
rfbClient* rfb_client = guac_client_data->rfb_client;
|
||||||
|
|
||||||
|
if (guac_client_data->audio_enabled) {
|
||||||
|
|
||||||
|
/* Wait for audio read and send threads to join */
|
||||||
|
if (guac_client_data->audio_read_thread)
|
||||||
|
pthread_join(*(guac_client_data->audio_read_thread), NULL);
|
||||||
|
|
||||||
|
if (guac_client_data->audio_send_thread)
|
||||||
|
pthread_join(*(guac_client_data->audio_send_thread), NULL);
|
||||||
|
|
||||||
|
/* Free up buffer allocated for audio stream */
|
||||||
|
if(guac_client_data->audio_buffer)
|
||||||
|
guac_pa_buffer_free(guac_client_data->audio_buffer);
|
||||||
|
}
|
||||||
|
|
||||||
/* Free encodings string, if used */
|
/* Free encodings string, if used */
|
||||||
if (guac_client_data->encodings != NULL)
|
if (guac_client_data->encodings != NULL)
|
||||||
free(guac_client_data->encodings);
|
free(guac_client_data->encodings);
|
||||||
|
Loading…
Reference in New Issue
Block a user