~ubuntu-branches/ubuntu/quantal/gst-plugins-bad0.10/quantal-proposed

« back to all changes in this revision

Viewing changes to gst/dccp/gstdccpserversink.c

  • Committer: Bazaar Package Importer
  • Author(s): Ken VanDine
  • Date: 2011-07-19 14:32:43 UTC
  • mfrom: (18.4.21 sid)
  • Revision ID: james.westby@ubuntu.com-20110719143243-p7pnkh45akfp0ihk
Tags: 0.10.22-2ubuntu1
* Rebased on debian unstable, remaining changes:
  - debian/gstreamer-plugins-bad.install
    * don't include dtmf, liveadder, rtpmux, autoconvert and shm, we include 
      them in -good

Show diffs side-by-side

added added

removed removed

Lines of Context:
168
168
gst_dccp_server_delete_dead_clients (void *arg)
169
169
{
170
170
  GstDCCPServerSink *sink = (GstDCCPServerSink *) arg;
171
 
  int i;
172
171
  GList *tmp = NULL;
 
172
  GList *l;
173
173
 
174
174
  pthread_mutex_lock (&lock);
175
 
  for (i = 0; i < g_list_length (sink->clients); i++) {
176
 
    Client *client = (Client *) g_list_nth_data (sink->clients, i);
 
175
  for (l = sink->clients; l != NULL; l = l->next) {
 
176
    Client *client = (Client *) l->data;
 
177
 
177
178
    if (client->flow_status == GST_FLOW_OK) {
178
179
      tmp = g_list_append (tmp, client);
179
180
    } else {
272
273
  GstDCCPServerSink *sink = GST_DCCP_SERVER_SINK (bsink);
273
274
 
274
275
  pthread_t thread_id;
275
 
  int i;
 
276
  GList *l;
276
277
 
277
278
  pthread_mutex_lock (&lock);
278
279
 
279
 
  for (i = 0; i < g_list_length (sink->clients); i++) {
280
 
    Client *client = (Client *) g_list_nth_data (sink->clients, i);
 
280
  for (l = sink->clients; l != NULL; l = l->next) {
 
281
    Client *client = (Client *) l->data;
 
282
 
281
283
    client->buf = buf;
282
284
    client->server = sink;
283
285
 
 
286
    /* FIXME: are we really creating a new thread here for every single buffer
 
287
     * and every single client? */
284
288
    if (client->flow_status == GST_FLOW_OK) {
285
289
      pthread_create (&thread_id, NULL, gst_dccp_server_send_buffer,
286
290
          (void *) client);
287
291
      pthread_detach (thread_id);
288
292
    } else {
 
293
      /* FIXME: what's the point of doing this in a separate thread if it
 
294
       * keeps he global lock anyway while going through all the clients and
 
295
       * waiting for close() to finish? */
289
296
      pthread_create (&thread_id, NULL, gst_dccp_server_delete_dead_clients,
290
297
          (void *) sink);
291
298
      pthread_detach (thread_id);
300
307
gst_dccp_server_sink_stop (GstBaseSink * bsink)
301
308
{
302
309
  GstDCCPServerSink *sink;
303
 
  int i;
 
310
  GList *l;
 
311
 
304
312
  sink = GST_DCCP_SERVER_SINK (bsink);
305
313
 
306
314
  if (sink->wait_connections == TRUE) {
310
318
  gst_dccp_socket_close (GST_ELEMENT (sink), &(sink->sock_fd));
311
319
 
312
320
  pthread_mutex_lock (&lock);
313
 
  for (i = 0; i < g_list_length (sink->clients); i++) {
314
 
    Client *client = (Client *) g_list_nth_data (sink->clients, i);
 
321
  for (l = sink->clients; l != NULL; l = l->next) {
 
322
    Client *client = (Client *) l->data;
 
323
 
315
324
    if (client->socket != DCCP_DEFAULT_CLIENT_SOCK_FD && sink->closed == TRUE) {
316
325
      gst_dccp_socket_close (GST_ELEMENT (sink), &(client->socket));
317
326
    }