aboutsummaryrefslogtreecommitdiffstats
path: root/net
diff options
context:
space:
mode:
authorobrien <obrien@FreeBSD.org>2007-08-24 07:53:59 +0800
committerobrien <obrien@FreeBSD.org>2007-08-24 07:53:59 +0800
commit5b606143fd1805b5643f728c372e0bf01ce470b3 (patch)
tree93db1735a8ea16bb691a1c8ac0c93bf6bc46d7b3 /net
parentc8fef1236dd2d37182dac48f0020ba28d8a06135 (diff)
downloadfreebsd-ports-gnome-5b606143fd1805b5643f728c372e0bf01ce470b3.tar.gz
freebsd-ports-gnome-5b606143fd1805b5643f728c372e0bf01ce470b3.tar.zst
freebsd-ports-gnome-5b606143fd1805b5643f728c372e0bf01ce470b3.zip
Upon server-initiated closure of the sound device, rdesktop(1) hangs in
a tight loop if the sound packet buffer is not empty. This usually occurs after a long playback, and is indicated by an endless stream of "ERROR: select: Bad file descriptor" messages on stderr. Fix: forcibly empty the sound packet buffer after closing the sound device. PR: 115692 Submitted by: "Eugene M. Kim" <freebsd.org@ab.ote.we.lv>
Diffstat (limited to 'net')
-rw-r--r--net/rdesktop/files/patch-rdpsnd_oss.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/net/rdesktop/files/patch-rdpsnd_oss.c b/net/rdesktop/files/patch-rdpsnd_oss.c
new file mode 100644
index 000000000000..636805eb85ec
--- /dev/null
+++ b/net/rdesktop/files/patch-rdpsnd_oss.c
@@ -0,0 +1,57 @@
+--- rdpsnd_oss.c.orig 2007-08-20 23:20:40.000000000 -0700
++++ rdpsnd_oss.c 2007-08-20 23:21:51.000000000 -0700
+@@ -51,6 +51,35 @@
+ } packet_queue[MAX_QUEUE];
+ static unsigned int queue_hi, queue_lo;
+
++/** Frees the first audio packet in the queue (that is, packet_queue[queue_lo]),
++ * sending a completion notification back to the server.
++ *
++ * @return True if the packet queue has become empty; False otherwise.&nbsp;
++ *
++ * If the packet queue is not empty, queue_lo will point at the next packet to
++ * play.
++ */
++static BOOL
++packet_done(void)
++{
++ struct audio_packet *packet = &packet_queue[queue_lo++];
++ queue_lo %= MAX_QUEUE;
++ rdpsnd_send_completion(packet->tick, packet->index);
++ free(packet->s.data);
++ return (queue_lo == queue_hi);
++}
++
++/** Discards all audio packets queued, sending completion notifications back to
++ * the server as necessary.
++ */
++static void
++clear_queue(void)
++{
++ while (queue_lo != queue_hi)
++ packet_done();
++ g_dsp_busy = False;
++}
++
+ BOOL
+ wave_out_open(void)
+ {
+@@ -74,6 +103,7 @@
+ wave_out_close(void)
+ {
+ close(g_dsp_fd);
++ clear_queue();
+ }
+
+ BOOL
+@@ -277,9 +307,7 @@
+
+ if (elapsed >= (duration * 85) / 100)
+ {
+- rdpsnd_send_completion(packet->tick, packet->index);
+- free(out->data);
+- queue_lo = (queue_lo + 1) % MAX_QUEUE;
++ packet_done();
+ started = False;
+ }
+ else