You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@guacamole.apache.org by jm...@apache.org on 2017/03/17 17:43:41 UTC

[1/3] incubator-guacamole-server git commit: GUACAMOLE-240: Always pass guac_pa_stream to PulseAudio callbacks.

Repository: incubator-guacamole-server
Updated Branches:
  refs/heads/staging/0.9.12-incubating 145762a2b -> cbca2f169


GUACAMOLE-240: Always pass guac_pa_stream to PulseAudio callbacks.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/adf9db74
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/adf9db74
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/adf9db74

Branch: refs/heads/staging/0.9.12-incubating
Commit: adf9db74540414e9455c5bfbc5661b0125789560
Parents: 145762a
Author: Michael Jumper <mj...@apache.org>
Authored: Thu Mar 16 02:53:32 2017 +0000
Committer: Michael Jumper <mj...@apache.org>
Committed: Wed Mar 15 21:24:29 2017 -0700

----------------------------------------------------------------------
 src/pulse/pulse.c | 18 +++++++++++-------
 1 file changed, 11 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/adf9db74/src/pulse/pulse.c
----------------------------------------------------------------------
diff --git a/src/pulse/pulse.c b/src/pulse/pulse.c
index af1680d..03f6d52 100644
--- a/src/pulse/pulse.c
+++ b/src/pulse/pulse.c
@@ -122,7 +122,9 @@ static void __stream_state_callback(pa_stream* stream, void* data) {
 static void __context_get_sink_info_callback(pa_context* context,
         const pa_sink_info* info, int is_last, void* data) {
 
-    guac_client* client = (guac_client*) data;
+    guac_pa_stream* guac_stream = (guac_pa_stream*) data;
+    guac_client* client = guac_stream->client;
+
     pa_stream* stream;
     pa_sample_spec spec;
     pa_buffer_attr attr;
@@ -146,8 +148,8 @@ static void __context_get_sink_info_callback(pa_context* context,
     stream = pa_stream_new(context, "Guacamole Audio", &spec, NULL);
 
     /* Set stream callbacks */
-    pa_stream_set_state_callback(stream, __stream_state_callback, client);
-    pa_stream_set_read_callback(stream, __stream_read_callback, client);
+    pa_stream_set_state_callback(stream, __stream_state_callback, guac_stream);
+    pa_stream_set_read_callback(stream, __stream_read_callback, guac_stream);
 
     /* Start stream */
     pa_stream_connect_record(stream, info->monitor_source_name, &attr,
@@ -159,7 +161,8 @@ static void __context_get_sink_info_callback(pa_context* context,
 static void __context_get_server_info_callback(pa_context* context,
         const pa_server_info* info, void* data) {
 
-    guac_client* client = (guac_client*) data;
+    guac_pa_stream* guac_stream = (guac_pa_stream*) data;
+    guac_client* client = guac_stream->client;
 
     /* If no default sink, cannot continue */
     if (info->default_sink_name == NULL) {
@@ -174,13 +177,14 @@ static void __context_get_server_info_callback(pa_context* context,
     pa_operation_unref(
             pa_context_get_sink_info_by_name(context,
                 info->default_sink_name, __context_get_sink_info_callback,
-                client));
+                guac_stream));
 
 }
 
 static void __context_state_callback(pa_context* context, void* data) {
 
-    guac_client* client = (guac_client*) data;
+    guac_pa_stream* guac_stream = (guac_pa_stream*) data;
+    guac_client* client = guac_stream->client;
 
     switch (pa_context_get_state(context)) {
 
@@ -205,7 +209,7 @@ static void __context_state_callback(pa_context* context, void* data) {
         case PA_CONTEXT_READY:
             guac_client_log(client, GUAC_LOG_INFO, "PulseAudio now ready");
             pa_operation_unref(pa_context_get_server_info(context,
-                        __context_get_server_info_callback, client));
+                        __context_get_server_info_callback, guac_stream));
             break;
 
         case PA_CONTEXT_FAILED:


[2/3] incubator-guacamole-server git commit: GUACAMOLE-240: Document parameters and behavior of PulseAudio callbacks.

Posted by jm...@apache.org.
GUACAMOLE-240: Document parameters and behavior of PulseAudio callbacks.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/6a3ce58a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/6a3ce58a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/6a3ce58a

Branch: refs/heads/staging/0.9.12-incubating
Commit: 6a3ce58ab7af6faf962978680a2a012d3d13d6c7
Parents: adf9db7
Author: Michael Jumper <mj...@apache.org>
Authored: Wed Mar 15 22:26:11 2017 -0700
Committer: Michael Jumper <mj...@apache.org>
Committed: Wed Mar 15 22:26:11 2017 -0700

----------------------------------------------------------------------
 src/pulse/pulse.c | 71 ++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 71 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/blob/6a3ce58a/src/pulse/pulse.c
----------------------------------------------------------------------
diff --git a/src/pulse/pulse.c b/src/pulse/pulse.c
index 03f6d52..2f30b1a 100644
--- a/src/pulse/pulse.c
+++ b/src/pulse/pulse.c
@@ -58,6 +58,20 @@ static int guac_pa_is_silence(const void* buffer, size_t length) {
 
 }
 
+/**
+ * Callback invoked by PulseAudio when PCM data is available for reading
+ * from the given stream. The PCM data can be read using pa_stream_peek().
+ *
+ * @param stream
+ *     The PulseAudio stream which has PCM data available.
+ *
+ * @param length
+ *     The number of bytes of PCM data available on the given stream.
+ *
+ * @param data
+ *     A pointer to the guac_pa_stream structure associated with the Guacamole
+ *     stream receiving audio data from PulseAudio.
+ */
 static void __stream_read_callback(pa_stream* stream, size_t length,
         void* data) {
 
@@ -82,6 +96,17 @@ static void __stream_read_callback(pa_stream* stream, size_t length,
 
 }
 
+/**
+ * Callback invoked by PulseAudio when the audio stream has changed state. The
+ * new state can be retrieved using pa_stream_get_state().
+ *
+ * @param stream
+ *     The PulseAudio stream which has changed state.
+ *
+ * @param data
+ *     A pointer to the guac_pa_stream structure associated with the Guacamole
+ *     stream receiving audio data from PulseAudio.
+ */
 static void __stream_state_callback(pa_stream* stream, void* data) {
 
     guac_pa_stream* guac_stream = (guac_pa_stream*) data;
@@ -119,6 +144,28 @@ static void __stream_state_callback(pa_stream* stream, void* data) {
 
 }
 
+/**
+ * Callback invoked by PulseAudio when the audio sink information has been
+ * retrieved. The callback is invoked repeatedly, once for each available
+ * sink, followed by one final invocation with the is_last flag set. The final
+ * invocation (with is_last set) does not describe a sink; it serves as a
+ * terminator only.
+ *
+ * @param context 
+ *     The PulseAudio context which is providing the sink information.
+ *
+ * @param info
+ *     Information describing an available audio sink.
+ *
+ * @param is_last
+ *     Non-zero if this invocation is the final invocation of this callback for
+ *     all currently-available sinks (and this invocation does not describe a
+ *     sink), zero otherwise.
+ *
+ * @param data
+ *     A pointer to the guac_pa_stream structure associated with the Guacamole
+ *     stream receiving audio data from PulseAudio.
+ */
 static void __context_get_sink_info_callback(pa_context* context,
         const pa_sink_info* info, int is_last, void* data) {
 
@@ -158,6 +205,19 @@ static void __context_get_sink_info_callback(pa_context* context,
 
 }
 
+/**
+ * Callback invoked by PulseAudio when server information has been retrieved.
+ *
+ * @param context 
+ *     The PulseAudio context which is providing the sink information.
+ *
+ * @param info
+ *     Information describing the PulseAudio server.
+ *
+ * @param data
+ *     A pointer to the guac_pa_stream structure associated with the Guacamole
+ *     stream receiving audio data from PulseAudio.
+ */
 static void __context_get_server_info_callback(pa_context* context,
         const pa_server_info* info, void* data) {
 
@@ -181,6 +241,17 @@ static void __context_get_server_info_callback(pa_context* context,
 
 }
 
+/**
+ * Callback invoked by PulseAudio when the overall audio context has changed
+ * state. The new state can be retrieved using pa_context_get_state().
+ *
+ * @param context 
+ *     The PulseAudio context which has changed state.
+ *
+ * @param data
+ *     A pointer to the guac_pa_stream structure associated with the Guacamole
+ *     stream receiving audio data from PulseAudio.
+ */
 static void __context_state_callback(pa_context* context, void* data) {
 
     guac_pa_stream* guac_stream = (guac_pa_stream*) data;


[3/3] incubator-guacamole-server git commit: GUACAMOLE-240: Merge PulseAudio callback fix.

Posted by jm...@apache.org.
GUACAMOLE-240: Merge PulseAudio callback fix.


Project: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/commit/cbca2f16
Tree: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/tree/cbca2f16
Diff: http://git-wip-us.apache.org/repos/asf/incubator-guacamole-server/diff/cbca2f16

Branch: refs/heads/staging/0.9.12-incubating
Commit: cbca2f169b708a34dabc72a91a9a2dec653126fb
Parents: 145762a 6a3ce58
Author: James Muehlner <ja...@guac-dev.org>
Authored: Fri Mar 17 10:40:15 2017 -0700
Committer: James Muehlner <ja...@guac-dev.org>
Committed: Fri Mar 17 10:40:15 2017 -0700

----------------------------------------------------------------------
 src/pulse/pulse.c | 89 ++++++++++++++++++++++++++++++++++++++++++++++----
 1 file changed, 82 insertions(+), 7 deletions(-)
----------------------------------------------------------------------