|
|
20333d |
From 0e568836a130a51ded1b905745e9079f44e801a5 Mon Sep 17 00:00:00 2001
|
|
|
4c08dd |
From: Yonit Halperin <yhalperi@redhat.com>
|
|
|
4c08dd |
Date: Thu, 25 Jul 2013 15:07:43 -0400
|
|
|
20333d |
Subject: [PATCH] snd_worker/snd_disconnect_channel: don't call snd_channel_put
|
|
|
20333d |
if the channel has already been disconnected
|
|
|
4c08dd |
|
|
|
4c08dd |
The snd channels has one reference as long as their socket is active.
|
|
|
4c08dd |
The playback channel has an additional reference for each frame that is
|
|
|
4c08dd |
currently filled by the sound device.
|
|
|
4c08dd |
Once the channel is disconnected (the socket has been freed and the
|
|
|
4c08dd |
first reference is released) snd_disconnect_channel shouldn't release
|
|
|
4c08dd |
a reference again.
|
|
|
4c08dd |
---
|
|
|
4c08dd |
server/snd_worker.c | 20 ++++++++++----------
|
|
|
4c08dd |
1 file changed, 10 insertions(+), 10 deletions(-)
|
|
|
4c08dd |
|
|
|
4c08dd |
diff --git a/server/snd_worker.c b/server/snd_worker.c
|
|
|
4c08dd |
index 849f002..3827416 100644
|
|
|
4c08dd |
--- a/server/snd_worker.c
|
|
|
4c08dd |
+++ b/server/snd_worker.c
|
|
|
4c08dd |
@@ -212,21 +212,20 @@ static void snd_disconnect_channel(SndChannel *channel)
|
|
|
4c08dd |
{
|
|
|
4c08dd |
SndWorker *worker;
|
|
|
4c08dd |
|
|
|
4c08dd |
- if (!channel) {
|
|
|
4c08dd |
+ if (!channel || !channel->stream) {
|
|
|
4c08dd |
spice_debug("not connected");
|
|
|
4c08dd |
return;
|
|
|
4c08dd |
}
|
|
|
4c08dd |
spice_debug("%p", channel);
|
|
|
4c08dd |
worker = channel->worker;
|
|
|
4c08dd |
- if (channel->stream) {
|
|
|
4c08dd |
- channel->cleanup(channel);
|
|
|
4c08dd |
- red_channel_client_disconnect(worker->connection->channel_client);
|
|
|
4c08dd |
- core->watch_remove(channel->stream->watch);
|
|
|
4c08dd |
- channel->stream->watch = NULL;
|
|
|
4c08dd |
- reds_stream_free(channel->stream);
|
|
|
4c08dd |
- channel->stream = NULL;
|
|
|
4c08dd |
- spice_marshaller_destroy(channel->send_data.marshaller);
|
|
|
4c08dd |
- }
|
|
|
4c08dd |
+ channel->cleanup(channel);
|
|
|
4c08dd |
+ red_channel_client_disconnect(worker->connection->channel_client);
|
|
|
4c08dd |
+ worker->connection->channel_client = NULL;
|
|
|
4c08dd |
+ core->watch_remove(channel->stream->watch);
|
|
|
4c08dd |
+ channel->stream->watch = NULL;
|
|
|
4c08dd |
+ reds_stream_free(channel->stream);
|
|
|
4c08dd |
+ channel->stream = NULL;
|
|
|
4c08dd |
+ spice_marshaller_destroy(channel->send_data.marshaller);
|
|
|
4c08dd |
snd_channel_put(channel);
|
|
|
4c08dd |
worker->connection = NULL;
|
|
|
4c08dd |
}
|
|
|
4c08dd |
@@ -897,6 +896,7 @@ static SndChannel *__new_channel(SndWorker *worker, int size, uint32_t channel_i
|
|
|
4c08dd |
int tos;
|
|
|
4c08dd |
MainChannelClient *mcc = red_client_get_main(client);
|
|
|
4c08dd |
|
|
|
4c08dd |
+ spice_assert(stream);
|
|
|
4c08dd |
if ((flags = fcntl(stream->socket, F_GETFL)) == -1) {
|
|
|
4c08dd |
spice_printerr("accept failed, %s", strerror(errno));
|
|
|
4c08dd |
goto error1;
|