Move files to proper location. Get rid of unnecessary lock. Remove wrongly-committed file.

This commit is contained in:
Michael Jumper 2013-08-08 18:43:03 -07:00
parent 9f167cc26a
commit 2a18630718
11 changed files with 41 additions and 136 deletions

View File

@ -1,54 +0,0 @@
# Set environment variables
env:
global:
- secure: "eNufz0915oMHd4cNbvo+YysNgJSP3IFrsWPFkVtg2S/L3hCv9+sTto/yuX00\nHvaJ1lcvak2DkiQmslJubcjpGNOysjp6rjhY92YodZs+wZwsrevjoanj9qWH\nwHz2eM1N6fvebMmzNS9fwwFmY3DiCDwBoTssz8aLs0etg+2xVBw="
matrix:
- secure: "eNufz0915oMHd4cNbvo+YysNgJSP3IFrsWPFkVtg2S/L3hCv9+sTto/yuX00\nHvaJ1lcvak2DkiQmslJubcjpGNOysjp6rjhY92YodZs+wZwsrevjoanj9qWH\nwHz2eM1N6fvebMmzNS9fwwFmY3DiCDwBoTssz8aLs0etg+2xVBw="
# use c and gcc
language: c
compiler: gcc
# install all vnc-related dependencies
before_install:
- sudo apt-get install tomcat6
- sudo apt-get install libvncserver0
- sudo apt-get install libvncserver-dev
- sudo apt-get install libfreerdp1
- sudo apt-get install libvorbis-dev
- sudo apt-get install libvorbisenc2
- sudo apt-get install libpulse-dev
- sudo apt-get install libcairo2-dev
- git clone git://github.com/cmujedi/libguac.git
- cd libguac
- autoreconf -i
- ./configure
- make
- sudo make install
- sudo ldconfig
- cd ..
# before build script, run autoreconf
before_script: autoreconf -i
# Default is "./configure && make && make test", but no tests yet
script: "./configure && make"
# after build script, run make install
after_success:
- sudo make install
- curl -s -o output.txt $IRC_TREELOGIC_CHANNEL_TOKEN -d "service=TravisCI" -d "message=$TRAVIS_REPO_SLUG $TRAVIS_BUILD_NUMBER ( $TRAVIS_BRANCH - $TRAVIS_COMMIT ) - Passed" -d "url=https://grove.io/app" -d "icon_url=https://secure.travis-ci.org/$TRAVIS_REPO_SLUG.png"
# after build script, run make install
after_failure:
- curl -s -o output.txt $IRC_TREELOGIC_CHANNEL_TOKEN -d "service=TravisCI" -d "message=$TRAVIS_REPO_SLUG $TRAVIS_BUILD_NUMBER ( $TRAVIS_BRANCH - $TRAVIS_COMMIT ) - Failed" -d "url=https://grove.io/app" -d "icon_url=https://secure.travis-ci.org/$TRAVIS_REPO_SLUG.png"
# add notification email addresses
notifications:
email:
recipients:
- cmujedi@west.cmu.edu
webhooks:
- secure: "eNufz0915oMHd4cNbvo+YysNgJSP3IFrsWPFkVtg2S/L3hCv9+sTto/yuX00\nHvaJ1lcvak2DkiQmslJubcjpGNOysjp6rjhY92YodZs+wZwsrevjoanj9qWH\nwHz2eM1N6fvebMmzNS9fwwFmY3DiCDwBoTssz8aLs0etg+2xVBw="

View File

@ -42,28 +42,25 @@ AM_CFLAGS = -Werror -Wall -pedantic -Iinclude @LIBGUAC_INCLUDE@
lib_LTLIBRARIES = libguac-client-vnc.la lib_LTLIBRARIES = libguac-client-vnc.la
libguac_client_vnc_la_SOURCES = \ libguac_client_vnc_la_SOURCES = \
buffer.c \
client.c \ client.c \
vnc_handlers.c \ convert.c \
guac_handlers.c \ guac_handlers.c \
convert.c queue.c \
vnc_handlers.c
noinst_HEADERS = \ noinst_HEADERS = \
buffer.h \
client.h \ client.h \
vnc_handlers.h \ convert.h \
guac_handlers.h \ guac_handlers.h \
convert.h queue.h \
vnc_handlers.h
# Optional PulseAudio support # Optional PulseAudio support
if ENABLE_PULSE if ENABLE_PULSE
libguac_client_vnc_la_SOURCES += \ libguac_client_vnc_la_SOURCES += pa_handlers.c
pa_handlers.c \ noinst_HEADERS += pa_handlers.h
queue.c \
buffer.c
noinst_HEADERS += \
pa_handlers.h \
queue.h \
buffer.h
endif endif
libguac_client_vnc_la_LDFLAGS = -version-info 0:0:0 @VNC_LIBS@ @CAIRO_LIBS@ @PULSE_LIBS@ libguac_client_vnc_la_LDFLAGS = -version-info 0:0:0 @VNC_LIBS@ @CAIRO_LIBS@ @PULSE_LIBS@

View File

@ -44,12 +44,7 @@
#include <guacamole/socket.h> #include <guacamole/socket.h>
#include <guacamole/protocol.h> #include <guacamole/protocol.h>
#include <guacamole/client.h> #include <guacamole/client.h>
#include <guacamole/audio.h> #include <guacamole/audio.h>
#include <guacamole/wav_encoder.h>
#ifdef ENABLE_OGG
#include <guacamole/ogg_encoder.h>
#endif
#include "client.h" #include "client.h"
#include "vnc_handlers.h" #include "vnc_handlers.h"
@ -111,13 +106,13 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
rfbClient* rfb_client; rfbClient* rfb_client;
vnc_guac_client_data* guac_client_data; vnc_guac_client_data* guac_client_data;
#ifdef ENABLE_PULSE
audio_args* args; audio_args* args;
pthread_t pa_read_thread, pa_send_thread; pthread_t pa_read_thread, pa_send_thread;
#endif
int read_only; int read_only;
int i;
/* Set up libvncclient logging */ /* Set up libvncclient logging */
rfbClientLog = guac_vnc_client_log_info; rfbClientLog = guac_vnc_client_log_info;
@ -173,37 +168,19 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
#ifdef ENABLE_PULSE #ifdef ENABLE_PULSE
guac_client_data->audio_enabled = (strcmp(argv[IDX_DISABLE_AUDIO], "true") != 0); guac_client_data->audio_enabled = (strcmp(argv[IDX_DISABLE_AUDIO], "true") != 0);
/* If audio enabled, choose an encoder */ /* If an encoding is available, load an audio stream */
if (guac_client_data->audio_enabled) { if (guac_client_data->audio_enabled) {
/* Choose an encoding */ guac_client_data->audio = guac_audio_stream_alloc(client, NULL);
for (i=0; client->info.audio_mimetypes[i] != NULL; i++) {
/* If successful, init audio system */
const char* mimetype = client->info.audio_mimetypes[i];
#ifdef ENABLE_OGG
/* If Ogg is supported, done. */
if (strcmp(mimetype, ogg_encoder->mimetype) == 0) {
guac_client_log_info(client, "Loading Ogg Vorbis encoder.");
guac_client_data->audio = audio_stream_alloc(client,
ogg_encoder);
break;
}
#endif
/* If wav is supported, done. */
if (strcmp(mimetype, wav_encoder->mimetype) == 0) {
guac_client_log_info(client, "Loading wav encoder.");
guac_client_data->audio = audio_stream_alloc(client,
wav_encoder);
break;
}
}
/* If an encoding is available, load the sound plugin */
if (guac_client_data->audio != NULL) { if (guac_client_data->audio != NULL) {
guac_client_log_info(client,
"Audio will be encoded as %s",
guac_client_data->audio->encoder->mimetype);
guac_client_data->audio_buffer = guac_pa_buffer_alloc(); guac_client_data->audio_buffer = guac_pa_buffer_alloc();
args = malloc(sizeof(audio_args)); args = malloc(sizeof(audio_args));
@ -211,8 +188,10 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
args->audio_buffer = guac_client_data->audio_buffer; args->audio_buffer = guac_client_data->audio_buffer;
/* Create a thread to read audio data */ /* Create a thread to read audio data */
if (pthread_create(&pa_read_thread, NULL, guac_pa_read_audio, (void*) args)) { if (pthread_create(&pa_read_thread, NULL, guac_pa_read_audio,
guac_protocol_send_error(client->socket, "Error initializing PulseAudio thread"); (void*) args)) {
guac_protocol_send_error(client->socket,
"Error initializing PulseAudio thread");
guac_socket_flush(client->socket); guac_socket_flush(client->socket);
return 1; return 1;
} }
@ -220,17 +199,25 @@ int guac_client_init(guac_client* client, int argc, char** argv) {
guac_client_data->audio_read_thread = &pa_read_thread; guac_client_data->audio_read_thread = &pa_read_thread;
/* Create a thread to send audio data */ /* Create a thread to send audio data */
if (pthread_create(&pa_send_thread, NULL, guac_pa_send_audio, (void*) args)) { if (pthread_create(&pa_send_thread, NULL, guac_pa_send_audio,
guac_protocol_send_error(client->socket, "Error initializing PulseAudio thread"); (void*) args)) {
guac_protocol_send_error(client->socket,
"Error initializing PulseAudio thread");
guac_socket_flush(client->socket); guac_socket_flush(client->socket);
return 1; return 1;
} }
guac_client_data->audio_send_thread = &pa_send_thread; guac_client_data->audio_send_thread = &pa_send_thread;
} }
/* Otherwise, audio loading failed */
else else
guac_client_log_info(client, "No available audio encoding. Sound disabled."); guac_client_log_info(client,
"No available audio encoding. Sound disabled.");
/* Require threadsafe sockets if audio enabled */
guac_socket_require_threadsafe(client->socket);
} /* end if audio enabled */ } /* end if audio enabled */
#endif #endif

View File

@ -66,7 +66,7 @@ typedef struct vnc_guac_client_data {
/** /**
* Audio output, if any. * Audio output, if any.
*/ */
audio_stream* audio; guac_audio_stream* audio;
/** /**
* Audio buffer, if any. * Audio buffer, if any.

View File

@ -39,7 +39,6 @@
#include <time.h> #include <time.h>
#include <syslog.h> #include <syslog.h>
#include <iconv.h> #include <iconv.h>
#include <pthread.h>
#include <cairo/cairo.h> #include <cairo/cairo.h>
@ -134,20 +133,12 @@ void guac_vnc_cursor(rfbClient* client, int x, int y, int w, int h, int bpp) {
/* Send cursor data*/ /* Send cursor data*/
surface = cairo_image_surface_create_for_data(buffer, CAIRO_FORMAT_ARGB32, w, h, stride); surface = cairo_image_surface_create_for_data(buffer, CAIRO_FORMAT_ARGB32, w, h, stride);
pthread_mutex_lock(&(gc->send_lock));
guac_protocol_send_png(socket, guac_protocol_send_png(socket,
GUAC_COMP_SRC, cursor_layer, 0, 0, surface); GUAC_COMP_SRC, cursor_layer, 0, 0, surface);
pthread_mutex_unlock(&(gc->send_lock));
pthread_mutex_lock(&(gc->send_lock));
/* Update cursor */ /* Update cursor */
guac_protocol_send_cursor(socket, x, y, cursor_layer, 0, 0, w, h); guac_protocol_send_cursor(socket, x, y, cursor_layer, 0, 0, w, h);
pthread_mutex_unlock(&(gc->send_lock));
/* Free surface */ /* Free surface */
cairo_surface_destroy(surface); cairo_surface_destroy(surface);
free(buffer); free(buffer);
@ -242,12 +233,8 @@ void guac_vnc_update(rfbClient* client, int x, int y, int w, int h) {
/* For now, only use default layer */ /* For now, only use default layer */
surface = cairo_image_surface_create_for_data(buffer, CAIRO_FORMAT_RGB24, w, h, stride); surface = cairo_image_surface_create_for_data(buffer, CAIRO_FORMAT_RGB24, w, h, stride);
pthread_mutex_lock(&(gc->send_lock));
guac_protocol_send_png(socket, GUAC_COMP_OVER, GUAC_DEFAULT_LAYER, x, y, surface); guac_protocol_send_png(socket, GUAC_COMP_OVER, GUAC_DEFAULT_LAYER, x, y, surface);
pthread_mutex_unlock(&(gc->send_lock));
/* Free surface */ /* Free surface */
cairo_surface_destroy(surface); cairo_surface_destroy(surface);
free(buffer); free(buffer);
@ -259,15 +246,11 @@ void guac_vnc_copyrect(rfbClient* client, int src_x, int src_y, int w, int h, in
guac_client* gc = rfbClientGetClientData(client, __GUAC_CLIENT); guac_client* gc = rfbClientGetClientData(client, __GUAC_CLIENT);
guac_socket* socket = gc->socket; guac_socket* socket = gc->socket;
pthread_mutex_lock(&(gc->send_lock));
/* For now, only use default layer */ /* For now, only use default layer */
guac_protocol_send_copy(socket, guac_protocol_send_copy(socket,
GUAC_DEFAULT_LAYER, src_x, src_y, w, h, GUAC_DEFAULT_LAYER, src_x, src_y, w, h,
GUAC_COMP_OVER, GUAC_DEFAULT_LAYER, dest_x, dest_y); GUAC_COMP_OVER, GUAC_DEFAULT_LAYER, dest_x, dest_y);
pthread_mutex_unlock(&(gc->send_lock));
((vnc_guac_client_data*) gc->data)->copy_rect_used = 1; ((vnc_guac_client_data*) gc->data)->copy_rect_used = 1;
} }
@ -320,14 +303,10 @@ rfbBool guac_vnc_malloc_framebuffer(rfbClient* rfb_client) {
guac_client* gc = rfbClientGetClientData(rfb_client, __GUAC_CLIENT); guac_client* gc = rfbClientGetClientData(rfb_client, __GUAC_CLIENT);
vnc_guac_client_data* guac_client_data = (vnc_guac_client_data*) gc->data; vnc_guac_client_data* guac_client_data = (vnc_guac_client_data*) gc->data;
pthread_mutex_lock(&(gc->send_lock));
/* Send new size */ /* Send new size */
guac_protocol_send_size(gc->socket, guac_protocol_send_size(gc->socket,
GUAC_DEFAULT_LAYER, rfb_client->width, rfb_client->height); GUAC_DEFAULT_LAYER, rfb_client->width, rfb_client->height);
pthread_mutex_unlock(&(gc->send_lock));
/* Use original, wrapped proc */ /* Use original, wrapped proc */
return guac_client_data->rfb_MallocFrameBuffer(rfb_client); return guac_client_data->rfb_MallocFrameBuffer(rfb_client);
} }
@ -340,12 +319,8 @@ void guac_vnc_cut_text(rfbClient* client, const char* text, int textlen) {
/* Convert ASCII character data to UTF-8 */ /* Convert ASCII character data to UTF-8 */
char* utf8_text = convert("ISO_8859-1", "UTF-8", text); char* utf8_text = convert("ISO_8859-1", "UTF-8", text);
pthread_mutex_lock(&(gc->send_lock));
guac_protocol_send_clipboard(socket, utf8_text); guac_protocol_send_clipboard(socket, utf8_text);
pthread_mutex_unlock(&(gc->send_lock));
free(utf8_text); free(utf8_text);
} }