Revision: 7249 http://playerstage.svn.sourceforge.net/playerstage/?rev=7249&view=rev Author: thjc Date: 2009-01-06 19:37:00 +0000 (Tue, 06 Jan 2009)
Log Message: ----------- Merge of 7248 from 2-1: Applied version of patch 2145007: fix up incorrect return type from playerc_client_read when sock < 0. Also removes small delay from read loop when not data is waiting (using a poll instead). Modified Paths: -------------- code/player/trunk/client_libs/libplayerc/client.c Property Changed: ---------------- code/player/trunk/ Property changes on: code/player/trunk ___________________________________________________________________ Modified: svn:mergeinfo - /code/player/branches/release-2-1-patches:6672-6673,6738,6834,6886,6905,6930,6936,6946,6951,6955,6975,6979-6981,6985,6987-6996,7087-7088,7204,7226,7230 /code/player/trunk:6985 + /code/player/branches/release-2-1-patches:6672-6673,6738,6834,6886,6905,6930,6936,6946,6951,6955,6975,6979-6981,6985,6987-6996,7087-7088,7204,7226,7230,7248 /code/player/trunk:6985 Modified: code/player/trunk/client_libs/libplayerc/client.c =================================================================== --- code/player/trunk/client_libs/libplayerc/client.c 2009-01-06 19:31:27 UTC (rev 7248) +++ code/player/trunk/client_libs/libplayerc/client.c 2009-01-06 19:37:00 UTC (rev 7249) @@ -622,23 +622,24 @@ // Read and process a packet (blocking) void *playerc_client_read(playerc_client_t *client) { - void* ret_proxy; + void* ret_proxy = NULL; int ret; - // 10ms delay - struct timespec sleeptime = {0,10000000}; - for(;;) + // In case we're in PULL mode, first request a round of data. + if(playerc_client_requestdata(client) < 0) + return NULL; + // now wait until we get a sync, or some data if in push mode + do { - // In case we're in PULL mode, first request a round of data. - if(playerc_client_requestdata(client) < 0) - return NULL; ret = playerc_client_read_nonblock_withproxy(client, &ret_proxy); - if((ret > 0) || (client->sock < 0)) + if (ret < 0 || client->sock < 0) + break; + if(ret > 0) return ret_proxy; - if (ret < 0) - return NULL; - nanosleep(&sleeptime,NULL); - } + // if no data is available, then do a peek with infinite timeout... + // we cant do this first as we may already have data waiting on the internal queue + } while (playerc_client_internal_peek(client, -1) >= 0); + return NULL; } @@ -1311,8 +1312,7 @@ { int i, j; playerc_device_t *device; - void * ret; - ret = NULL; + void *ret = NULL; // Look for a device proxy to handle this data for (i = 0; i < client->device_count; i++) This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. ------------------------------------------------------------------------------ Check out the new SourceForge.net Marketplace. It is the best place to buy or sell services for just about anything Open Source. http://p.sf.net/sfu/Xq1LFB _______________________________________________ Playerstage-commit mailing list Playerstage-commit@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/playerstage-commit