pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[pkgsrc/trunk]: pkgsrc/www/firefox/patches Make ALSA support build again. Ha...



details:   https://anonhg.NetBSD.org/pkgsrc/rev/b2b8e544e8b9
branches:  trunk
changeset: 651812:b2b8e544e8b9
user:      bad <bad%pkgsrc.org@localhost>
date:      Thu May 14 15:30:54 2015 +0000

description:
Make ALSA support build again.  Handle EBADFD only if it is #defined.

diffstat:

 www/firefox/patches/patch-media_libcubeb_src_cubeb__alsa.c |  70 +++++++------
 1 files changed, 36 insertions(+), 34 deletions(-)

diffs (truncated from 309 to 300 lines):

diff -r 5912c5bfb492 -r b2b8e544e8b9 www/firefox/patches/patch-media_libcubeb_src_cubeb__alsa.c
--- a/www/firefox/patches/patch-media_libcubeb_src_cubeb__alsa.c        Thu May 14 15:28:04 2015 +0000
+++ b/www/firefox/patches/patch-media_libcubeb_src_cubeb__alsa.c        Thu May 14 15:30:54 2015 +0000
@@ -1,7 +1,7 @@
-$NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.9 2015/04/05 12:54:11 ryoon Exp $
+$NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.10 2015/05/14 15:30:54 bad Exp $
 
---- media/libcubeb/src/cubeb_alsa.c.orig       2015-03-27 02:20:23.000000000 +0000
-+++ media/libcubeb/src/cubeb_alsa.c
+--- media/libcubeb/src/cubeb_alsa.c.orig       2015-05-08 16:55:17.000000000 +0000
++++ media/libcubeb/src/cubeb_alsa.c    2015-05-14 15:22:34.000000000 +0000
 @@ -7,12 +7,18 @@
  #undef NDEBUG
  #define _DEFAULT_SOURCE
@@ -73,7 +73,7 @@
  /* ALSA is not thread-safe.  snd_pcm_t instances are individually protected
     by the owning cubeb_stream's mutex.  snd_pcm_t creation and destruction
     is not thread-safe until ALSA 1.0.24 (see alsa-lib.git commit 91c9c8f1),
-@@ -65,6 +116,8 @@ struct cubeb {
+@@ -65,6 +116,8 @@
       workaround is not required. */
    snd_config_t * local_config;
    int is_pa;
@@ -82,7 +82,7 @@
  };
  
  enum stream_state {
-@@ -258,32 +311,35 @@ alsa_refill_stream(cubeb_stream * stm)
+@@ -258,32 +311,35 @@
    long got;
    void * p;
    int draining;
@@ -137,7 +137,7 @@
  
    /* This should never happen. */
    if ((unsigned int) avail > stm->buffer_size) {
-@@ -294,8 +350,8 @@ alsa_refill_stream(cubeb_stream * stm)
+@@ -294,8 +350,8 @@
       available to write.  If avail is still zero here, the stream must be in
       a funky state, so recover and try again. */
    if (avail == 0) {
@@ -148,7 +148,7 @@
      if (avail <= 0) {
        pthread_mutex_unlock(&stm->mutex);
        stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_ERROR);
-@@ -303,7 +359,7 @@ alsa_refill_stream(cubeb_stream * stm)
+@@ -303,7 +359,7 @@
      }
    }
  
@@ -157,7 +157,7 @@
    assert(p);
  
    pthread_mutex_unlock(&stm->mutex);
-@@ -312,10 +368,11 @@ alsa_refill_stream(cubeb_stream * stm)
+@@ -312,10 +368,11 @@
    if (got < 0) {
      pthread_mutex_unlock(&stm->mutex);
      stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_ERROR);
@@ -170,7 +170,7 @@
  
      if (stm->params.format == CUBEB_SAMPLE_FLOAT32NE) {
        float * b = (float *) p;
-@@ -328,14 +385,62 @@ alsa_refill_stream(cubeb_stream * stm)
+@@ -328,14 +385,64 @@
          b[i] *= stm->volume;
        }
      }
@@ -206,6 +206,7 @@
 +          return ERROR;
 +        }
 +        continue;
++#if defined(EBADFD)
 +      case -EBADFD:
 +        fprintf(stderr, "%s: snc_pcm_writei returned -%s, giving up\n",
 +                __func__, "EBADFD");
@@ -213,6 +214,7 @@
 +        stm->state_callback(stm, stm->user_ptr, CUBEB_STATE_ERROR);
 +        pthread_mutex_unlock(&stm->mutex);
 +        return ERROR;
++#endif
 +      }
 +      if (wrote < 0) {
 +        fprintf(stderr, "%s: snc_pcm_writei returned unexpected error %lld, "
@@ -241,7 +243,7 @@
    }
    if (got != avail) {
      long buffer_fill = stm->buffer_size - (avail - got);
-@@ -343,7 +448,7 @@ alsa_refill_stream(cubeb_stream * stm)
+@@ -343,7 +450,7 @@
  
      /* Fill the remaining buffer with silence to guarantee one full period
         has been written. */
@@ -250,7 +252,7 @@
  
      set_timeout(&stm->drain_timeout, buffer_time * 1000);
  
-@@ -454,26 +559,26 @@ get_slave_pcm_node(snd_config_t * lconf,
+@@ -454,26 +561,26 @@
  
    slave_def = NULL;
  
@@ -282,7 +284,7 @@
      if (r < 0) {
        break;
      }
-@@ -482,7 +587,7 @@ get_slave_pcm_node(snd_config_t * lconf,
+@@ -482,7 +589,7 @@
      if (r < 0 || r > (int) sizeof(node_name)) {
        break;
      }
@@ -291,7 +293,7 @@
      if (r < 0) {
        break;
      }
-@@ -491,7 +596,7 @@ get_slave_pcm_node(snd_config_t * lconf,
+@@ -491,7 +598,7 @@
    } while (0);
  
    if (slave_def) {
@@ -300,7 +302,7 @@
    }
  
    return NULL;
-@@ -514,22 +619,22 @@ init_local_config_with_workaround(char c
+@@ -514,22 +621,22 @@
  
    lconf = NULL;
  
@@ -327,7 +329,7 @@
      if (r < 0) {
        break;
      }
-@@ -538,7 +643,7 @@ init_local_config_with_workaround(char c
+@@ -538,7 +645,7 @@
      if (r < 0 || r > (int) sizeof(node_name)) {
        break;
      }
@@ -336,7 +338,7 @@
      if (r < 0) {
        break;
      }
-@@ -549,12 +654,12 @@ init_local_config_with_workaround(char c
+@@ -549,12 +656,12 @@
      }
  
      /* Fetch the PCM node's type, and bail out if it's not the PulseAudio plugin. */
@@ -351,7 +353,7 @@
      if (r < 0) {
        break;
      }
-@@ -565,18 +670,18 @@ init_local_config_with_workaround(char c
+@@ -565,18 +672,18 @@
  
      /* Don't clobber an explicit existing handle_underrun value, set it only
         if it doesn't already exist. */
@@ -373,7 +375,7 @@
      if (r < 0) {
        break;
      }
-@@ -584,7 +689,7 @@ init_local_config_with_workaround(char c
+@@ -584,7 +691,7 @@
      return lconf;
    } while (0);
  
@@ -382,7 +384,7 @@
  
    return NULL;
  }
-@@ -596,9 +701,9 @@ alsa_locked_pcm_open(snd_pcm_t ** pcm, s
+@@ -596,9 +703,9 @@
  
    pthread_mutex_lock(&cubeb_alsa_mutex);
    if (local_config) {
@@ -394,7 +396,7 @@
    }
    pthread_mutex_unlock(&cubeb_alsa_mutex);
  
-@@ -611,7 +716,7 @@ alsa_locked_pcm_close(snd_pcm_t * pcm)
+@@ -611,7 +718,7 @@
    int r;
  
    pthread_mutex_lock(&cubeb_alsa_mutex);
@@ -403,7 +405,7 @@
    pthread_mutex_unlock(&cubeb_alsa_mutex);
  
    return r;
-@@ -668,12 +773,65 @@ alsa_init(cubeb ** context, char const *
+@@ -668,12 +775,65 @@
    pthread_attr_t attr;
    snd_pcm_t * dummy;
  
@@ -470,7 +472,7 @@
      cubeb_alsa_error_handler_set = 1;
    }
    pthread_mutex_unlock(&cubeb_alsa_mutex);
-@@ -681,6 +839,8 @@ alsa_init(cubeb ** context, char const *
+@@ -681,6 +841,8 @@
    ctx = calloc(1, sizeof(*ctx));
    assert(ctx);
  
@@ -479,7 +481,7 @@
    ctx->ops = &alsa_ops;
  
    r = pthread_mutex_init(&ctx->mutex, NULL);
-@@ -730,7 +890,7 @@ alsa_init(cubeb ** context, char const *
+@@ -730,7 +892,7 @@
         config fails with EINVAL, the PA PCM is too old for this workaround. */
      if (r == -EINVAL) {
        pthread_mutex_lock(&cubeb_alsa_mutex);
@@ -488,7 +490,7 @@
        pthread_mutex_unlock(&cubeb_alsa_mutex);
        ctx->local_config = NULL;
      } else if (r >= 0) {
-@@ -769,9 +929,13 @@ alsa_destroy(cubeb * ctx)
+@@ -769,9 +931,13 @@
    pthread_mutex_destroy(&ctx->mutex);
    free(ctx->fds);
  
@@ -503,7 +505,7 @@
      pthread_mutex_unlock(&cubeb_alsa_mutex);
    }
  
-@@ -839,7 +1003,7 @@ alsa_stream_init(cubeb * ctx, cubeb_stre
+@@ -839,7 +1005,7 @@
      return CUBEB_ERROR;
    }
  
@@ -512,7 +514,7 @@
    assert(r == 0);
  
    /* Ugly hack: the PA ALSA plugin allows buffer configurations that can't
-@@ -849,23 +1013,23 @@ alsa_stream_init(cubeb * ctx, cubeb_stre
+@@ -849,23 +1015,23 @@
      latency = latency < 500 ? 500 : latency;
    }
  
@@ -542,7 +544,7 @@
    assert((nfds_t) r == stm->nfds);
  
    r = pthread_cond_init(&stm->cond, NULL);
-@@ -896,7 +1060,7 @@ alsa_stream_destroy(cubeb_stream * stm)
+@@ -896,7 +1062,7 @@
    pthread_mutex_lock(&stm->mutex);
    if (stm->pcm) {
      if (stm->state == DRAINING) {
@@ -551,7 +553,7 @@
      }
      alsa_locked_pcm_close(stm->pcm);
      stm->pcm = NULL;
-@@ -906,7 +1070,10 @@ alsa_stream_destroy(cubeb_stream * stm)
+@@ -906,7 +1072,10 @@
    pthread_mutex_destroy(&stm->mutex);
  
    r = pthread_cond_destroy(&stm->cond);
@@ -563,7 +565,7 @@
  
    alsa_unregister_stream(stm);
  
-@@ -938,12 +1105,12 @@ alsa_get_max_channel_count(cubeb * ctx, 
+@@ -938,12 +1107,12 @@
      return CUBEB_ERROR;
    }
  
@@ -578,7 +580,7 @@
    if (r < 0) {
      return CUBEB_ERROR;
    }
-@@ -963,34 +1130,34 @@ alsa_get_preferred_sample_rate(cubeb * c
+@@ -963,34 +1132,34 @@
  
    /* get a pcm, disabling resampling, so we get a rate the
     * hardware/dmix/pulse/etc. supports. */
@@ -621,7 +623,7 @@
  
    return CUBEB_OK;
  }
-@@ -1014,7 +1181,7 @@ alsa_stream_start(cubeb_stream * stm)
+@@ -1014,7 +1183,7 @@
    ctx = stm->context;
  
    pthread_mutex_lock(&stm->mutex);
@@ -630,7 +632,7 @@
    gettimeofday(&stm->last_activity, NULL);
    pthread_mutex_unlock(&stm->mutex);
  
-@@ -1048,7 +1215,7 @@ alsa_stream_stop(cubeb_stream * stm)
+@@ -1048,7 +1217,7 @@
    pthread_mutex_unlock(&ctx->mutex);
  
    pthread_mutex_lock(&stm->mutex);
@@ -639,7 +641,7 @@
    pthread_mutex_unlock(&stm->mutex);
  
    return CUBEB_OK;
-@@ -1064,14 +1231,17 @@ alsa_stream_get_position(cubeb_stream * 
+@@ -1064,14 +1233,17 @@
    pthread_mutex_lock(&stm->mutex);
  
    delay = -1;



Home | Main Index | Thread Index | Old Index