summaryrefslogtreecommitdiffstats
path: root/server/snd_worker.c
Commit message (Collapse)AuthorAgeFilesLines
* red_channel: remove unused migrate flag from RedChannelYonit Halperin2012-08-271-7/+3
| | | | The relevant flags reside in RedChannelClient and RedClient
* snd_worker: handling migrationYonit Halperin2012-08-271-61/+17
| | | | | | | | | | The playback and record channel send SPICE_MSG_MIGRATE to the client. Both playback and record channel does not have a state to restore: while in the legacy migration implementation the record channel used to restore the mode and start time, it looks unnecessary since the client receives from the src MSG_RECORD_STOP before the migration completion notification (when the vm is stopped). Afterwards, when the vm starts on the dest side, the client receives MSG_RECORD_START.
* snd_channel: fix double releaseYonit Halperin2012-08-271-10/+17
| | | | | | | | Due to the fix in the previous patch, snd_disconnect_channel can be called both when there is write/read error in the channel, or from red_client_destroy (which calls client_cbs.disconnect). Multiple calls to snd_disconnect_channel resulted in calling channel->cleanup(channel) more than once (double release).
* red_channel (dummy): fix not adding dummy RedChannelClient to the clientYonit Halperin2012-08-271-1/+1
| | | | | | | | | | | snd channel wasn't added to be part of the client's channels list. As a result, when the client was destroyed, or migrated, snd channel client wasn't destroy, or its migration callback wasn't called. However, due to adding dummy channels to the client, we need special handling for calls to disconnecting dummy channel clients. TODO: we need to refactor snd_worker to use red_channel
* server: handle red_channel_client_create returning NULLYonit Halperin2012-05-211-0/+3
|
* fix error-path return in snd_set_record_peer()Michael Tokarev2012-04-181-2/+2
| | | | | | The error_{1,2} labels in this functions are backwards. Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
* Use the spice-common logging functionsMarc-André Lureau2012-03-251-49/+49
| | | | | It will abort by default for critical level messages. That behaviour can be tuned at runtime.
* Use the spice-common submoduleMarc-André Lureau2012-03-251-2/+3
| | | | | | | | | | | | | | | | | | This patch will replace the common/ directory with the spice-common project. It is for now a simple project subdirectory shared with spice-gtk, but the goal is to make it a proper library later on. With this change, the spice-server build is broken. The following commits fix the build, and have been seperated to ease the review. v2 - moves all the generated marshallers to spice-common library - don't attempt to fix windows VS build, which should somehow be splitted with spice-common (or built from tarball only to avoid generation tools/libs deps) v3 - uses libspice-common-client - fix a mutex.h inclusion reported by Alon
* Ensure all members of ChannelCbs and ClientCbs are either assigned or NULLHans de Goede2012-03-101-2/+2
| | | | | | | | | | | | | | | While git-bisecting another issue I ended up hitting and not recognizing the bug fixed by commit 7a079b452b026d6ce38f95dcc397fa64b059fffb. While fixing this (again) I noticed that (even after the fix) not all users of ChannelCbs first zero it. So this patch ensures that all users of ChannelCbs first zero it, and does the same for ClientCbs while at it. Since before this patch there were multiple zero-ing styles, some using memset and other using a zero initializer this patch also unifies all the zero-ing to use a NULL initializer for the first element. Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Use standard IOV_MAX definition where applicableDan McGee2012-02-211-3/+6
| | | | | | | | This is provided by <limits.h> on all platforms as long as _XOPEN_SOURCE is defined. On Linux, this is 1024, on Solaris, this is 16, and on any other platform, we now respect the value supported by the OS. Signed-off-by: Dan McGee <dpmcgee@gmail.com>
* Remove extra '\n' from red_printf() callsDan McGee2012-02-141-1/+1
| | | | | | | red_printf() takes care of adding a newline to all messages; remove the extra newline from all messages and macros that were doubling them up. Signed-off-by: Dan McGee <dpmcgee@gmail.com>
* server: don't complain if setsockopt(SO_PRIORITY) call failsNahum Shalman2012-01-231-1/+7
| | | | | | | | | | dc7855967f4e did this for the TCP_NODELAY and IP_TOS calls; we should do it for priority as well if necessary. We also #ifdef the setting of the low-level socket priority based on whether we have a definition of SO_PRIORITY available. This option is not available on Illumos/Solaris platforms; however, since we set IP_TOS anyway it is not a big deal to omit it here.
* server: Don't complain if setsockopt NODELAY fails on unix socketsHans de Goede2012-01-181-2/+6
| | | | | | | | | | | | With Daniel P. Berrange's patches to allow use of pre-supplied fd's as channels, we can no longer be sure that our connections are TCP sockets, so it makes no sense to complain if a TCP/IP specific setsockopt fails with an errno of ENOTSUP. Note that this extends Daniel's commit 492ddb5d1d595e2d12208f4602b18e4432f4e6b4 which already added the same check to server/inputs_channel.c Signed-off-by: Hans de Goede <hdegoede@redhat.com>
* Remove trailing blank linesDaniel P. Berrange2012-01-131-1/+0
| | | | Remove any blank lines at the end of all source files
* server: add support for SPICE_COMMON_CAP_MINI_HEADERYonit Halperin2012-01-121-35/+58
| | | | | | | | | Support for a header without a serial and without sub list. red_channel: Support the two types of headers. Keep a consistent consecutive messages serial. red_worker: use urgent marshaller instead of sub list. snd_worker: Sound channels need special support since they still don't use red_channel for sending & receiving.
* server: set & test channel capabilities in red_channelYonit Halperin2011-11-021-41/+25
| | | | | | | The code for setting and testing channel capabilities was unnecessarily duplicated. Now it is in red_channel. RedsChannel was dropped from Reds; It was used only for holding the channels common capabilities, which are now held in RedChannel.
* server/snd_worker.c: add reference counting to SndChannelAlon Levy2011-08-231-3/+28
| | | | | | | | | | Fixes a valgrind discovered possible bug in spice-server - valgrind on test_playback saw it, didn't see it happen with qemu. The problem is that the frames buffers returned by spice_server_playback_get_buffer are part of the malloc'ed SndChannel, whose lifetime is smaller then that of SndWorker. As a result a pointer to a previously returned spice_server_playback_get_buffer could remain and be used after SndChannel has been freed because the client disconnected.
* server/snd_worker.c: add red_channel_client_destroy_dummyAlon Levy2011-08-231-0/+1
|
* server: registering RedChannel in reds, instead of ChannelYonit Halperin2011-08-231-60/+97
| | | | | | | | | | | | | | | | | | | | | | | Merging the functionality of reds::channel, into RedChannel. In addition, cleanup and fix disconnection code: before this patch, red_dispatcher_disconnect_display_client could have been called from the red_worker thread (and it must be called only from the io thread). RedChannel holds only connected channel clients. RedClient holds all the channel clients that were created till it is destroyed (and then it destroys them as well). Note: snd_channel still doesn't use red_channel, however it creates dummy channel and channel clients, in order to register itself in reds. server/red_channel.c: a channel is connected if it holds at least one channel client Previously I changed RedChannel to hold only connected channel clients and RedClient, to hold all the channel clients as long as it is not destroyed. usbredir: multichannel has not been tested, it just compiles.
* server/main_channel: move latency and bitrate to channel clientAlon Levy2011-08-231-1/+11
| | | | | | | | | | | | They were globals before. This introduces api for other channels to query the low bandwidth status. The queries themselves are still done from the wrong context (channel and not channel client) but that's because the decoupling of channel and channel client will be done in the following patches. Note that snd_worker.c got two copied function declarations that belong to main_channel.h but can't be easily dragged into snd_worker.c since it still uses it's own RedChannel struct.
* server: Add RedClientAlon Levy2011-08-231-6/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | That means RedClient tracks a ring of channels. Right now there will be only a single client because of the disconnection mechanism - whenever a new client comes we disconnect all existing clients. But this patch adds already a ring of clients to reds.c (stored in RedServer). There is a known problem handling many connections and disconnections at the same time, trigerrable easily by the following script: export NEW_DISPLAY=:3.0 Xephyr $NEW_DISPLAY -noreset & for ((i = 0 ; i < 5; ++i)); do for ((j = 0 ; j < 10; ++j)); do DISPLAY=$NEW_DISPLAY c_win7x86_qxl_tests & done sleep 2; done I fixed a few of the problems resulting from this in the same patch. This required already introducing a few other changes: * make sure all removal of channels happens in the main thread, for that two additional dispatcher calls are added to remove a specific channel client (RED_WORKER_MESSAGE_CURSOR_DISCONNECT_CLIENT and RED_WORKER_MESSAGE_DISPLAY_DISCONNECT_CLIENT). * change some asserts in input channel. * make main channel disconnect not recursive * introduce disconnect call back to red_channel_create_parser The remaining abort is from a double free in the main channel, still can't find it (doesn't happen when running under valgrind - probably due to the slowness resulting from that), but is easy to see when running under gdb.
* s/__visible__/SPICE_GNUC_VISIBLEChristophe Fergeau2011-06-221-13/+13
| | | | | The C specification reserves use of identifiers starting with __ to the compiler so we shouldn't use one such symbol.
* sndworker: check the caps before sending volume messagesMarc-André Lureau2011-06-221-10/+46
|
* sndworker: add AudioVolume/AudioMute messagesMarc-André Lureau2011-06-221-2/+170
| | | | | | | | | | | | | | | | | | | These messages allow the guest to send the audio device volume to the client. It uses an arbitrary scale of 16bits, which works good enough for now. Save VolumeState in {Playback,Record}State, so that we can send the current volume on channel connection. Note about future improvements: - add exact dB support - add client to guest volume change Updated since v2: - bumped record and playback interface minor version to allow conditional compilation Updated since v1: - sync record volume on connection too
* add #include <config.h> to all source filesChristophe Fergeau2011-05-031-0/+3
| | | | | | | | When using config.h, it must be the very first include in all source files since it contains #define that may change the compilation process (eg libc structure layout changes when it's used to enable large file support on 32 bit x86 archs). This commit adds it at the beginning of all .c and .cpp files
* server: s/desable/disableChristophe Fergeau2011-05-021-2/+2
| | | | | This fixes a typo in some function names, there should be no functional change.
* use foo(void) instead of foo() in prototypesChristophe Fergeau2011-05-021-1/+1
| | | | | In C, the latter isn't a prototype for a function with no arg, but declares a function with an undefined number of args.
* server: add reds_channel_dispose()Marc-André Lureau2011-02-281-2/+1
| | | | | | | | | | Try to have a common base dispose() method for channels. For now, it just free the caps. Make use of it in snd_worker, and in sync_write() - sync_write() is going to have default caps later on. https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: rename s/peer/streamMarc-André Lureau2011-02-281-22/+22
| | | | | | | | This is stylish change again. We are talking about a RedStream object, so let's just name the variable "stream" everywhere, to avoid confusion with a non existent RedPeer object. https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: use the new reds_stream_{read,write}Marc-André Lureau2011-02-281-2/+4
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: add reds_stream_{read,write,free,remove_watch}()Marc-André Lureau2011-02-271-2/+2
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* server: s/RedsStreamContext/RedsStreamMarc-André Lureau2011-02-271-4/+4
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=34795
* Add destructor for demarshalled messagesAlexander Larsson2010-06-221-2/+3
| | | | | | | This is required because we don't want to free messages that just refer to the unparsed message (like SpiceMsgData). Also, in the future we might need it for more complex demarshalling.
* Make sound data @as_ptr to avoid copying dataAlexander Larsson2010-06-181-1/+1
|
* Use generated demarshallers in serverAlexander Larsson2010-06-181-22/+40
|
* Convert snd_worker.c to use SpiceMarshaller and generated marshallersAlexander Larsson2010-06-181-145/+94
|
* sound: code style fixupsGerd Hoffmann2010-05-261-2/+4
|
* sound channels: restart audio on client reconnect.Gerd Hoffmann2010-05-211-1/+15
|
* zap vd_interface.hGerd Hoffmann2010-05-191-1/+1
| | | | move over content to spice.h
* vd_interface.h cleanups.Gerd Hoffmann2010-05-191-2/+0
| | | | | Drop leftover bits which are not used any more. Rename DrawArea to QXLDrawArea.
* SoundInterfaces: redesignGerd Hoffmann2010-05-191-80/+80
|
* VDInterface: redesign.Gerd Hoffmann2010-05-191-3/+3
| | | | | | | | | | | | VDInterface has been renamed to SpiceBaseInterface. Dropped base_version element, shlib versioning should be used instead. Dropped id element, it is passed to spice_server_add_interface() instead. Now SpiceBaseInterface has static information only, multiple interface instances can share it. Added SpiceBaseInstance struct for maintaining per-instance state information. Adapted spice_server_{add,remove}_interface() functions to the new world.
* new watch api: switch soundGerd Hoffmann2010-05-191-11/+21
|
* Relicense everything from GPL to LGPL 2.1+Alexander Larsson2010-04-131-9/+9
|
* Use spice allocator in server/Alexander Larsson2010-03-111-20/+5
|
* Use macros from <spice/macros.h> rather than duplicate themAlexander Larsson2010-03-091-8/+8
|
* Rename symbols that were changed in spice-protocolAlexander Larsson2010-02-041-69/+69
| | | | | | This is an automatic change using: $ find -name "*.[ch]" | xargs ../spice-protocol/rename-identifiers.sh ../spice-protocol/renames $ find -name "*.cpp" | xargs ../spice-protocol/rename-identifiers.sh ../spice-protocol/renames
* fresh startYaniv Kamay2009-10-141-0/+1300