diff options
author | tsutsui <tsutsui@pkgsrc.org> | 2017-10-23 15:25:28 +0000 |
---|---|---|
committer | tsutsui <tsutsui@pkgsrc.org> | 2017-10-23 15:25:28 +0000 |
commit | 9aeb9f58f61fbb007ac6c398b04effc5258eb009 (patch) | |
tree | 06c8e926e83e79c965b068fae417c6a34bd3dc69 /www/firefox | |
parent | 38732a4ae78d6a7c59a8f2500f29cd9540ecaf91 (diff) | |
download | pkgsrc-9aeb9f58f61fbb007ac6c398b04effc5258eb009.tar.gz |
forefox: fix a build error with "alsa" option on NetBSD.
Diffstat (limited to 'www/firefox')
-rw-r--r-- | www/firefox/distinfo | 4 | ||||
-rw-r--r-- | www/firefox/patches/patch-media_libcubeb_src_cubeb__alsa.c | 75 |
2 files changed, 42 insertions, 37 deletions
diff --git a/www/firefox/distinfo b/www/firefox/distinfo index 5ce00205388..619e52a743c 100644 --- a/www/firefox/distinfo +++ b/www/firefox/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.297 2017/10/17 03:39:04 ryoon Exp $ +$NetBSD: distinfo,v 1.298 2017/10/23 15:25:28 tsutsui Exp $ SHA1 (firefox-56.0.source.tar.xz) = 806cb335752ee93b204750b89dc6940768408088 RMD160 (firefox-56.0.source.tar.xz) = b5239242e55e3031838c9807bff47b5b9c9fb420 @@ -50,7 +50,7 @@ SHA1 (patch-js_xpconnect_src_XPCConvert.cpp) = 915777e9bb5366be41866cdb6ea0ad2b1 SHA1 (patch-js_xpconnect_src_xpcprivate.h) = 97a221c76593be712f670aa409f2f1ad5dc20628 SHA1 (patch-media_libcubeb_gtest_moz.build) = ebb4be6e6bca4a0ed6858516ec9fdb7828bbe2e1 SHA1 (patch-media_libcubeb_src_cubeb.c) = 1b1b8d57eb710cad13518ded79a0ddee2681881b -SHA1 (patch-media_libcubeb_src_cubeb__alsa.c) = 1b2890eea9d1b69ace8e5d6806e49ce4eb011236 +SHA1 (patch-media_libcubeb_src_cubeb__alsa.c) = b19e380278ca875600e49b76021b20f1f9e81980 SHA1 (patch-media_libcubeb_src_cubeb__jack.cpp) = 1b514a97e3c15d03acdc873d23ff665112984293 SHA1 (patch-media_libcubeb_src_cubeb__oss.c) = 88cdfb9b9aa8c2607ca79bfa7fce4353e65638f7 SHA1 (patch-media_libcubeb_src_moz.build) = 5fca6701cc890120a04483f52c25242ee7b1c051 diff --git a/www/firefox/patches/patch-media_libcubeb_src_cubeb__alsa.c b/www/firefox/patches/patch-media_libcubeb_src_cubeb__alsa.c index c28b8732a99..553a5212187 100644 --- a/www/firefox/patches/patch-media_libcubeb_src_cubeb__alsa.c +++ b/www/firefox/patches/patch-media_libcubeb_src_cubeb__alsa.c @@ -1,11 +1,16 @@ -$NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon Exp $ +$NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.25 2017/10/23 15:25:28 tsutsui Exp $ * Support alsa audio under NetBSD * Avoid https://github.com/kinetiknz/cubeb/issues/226 --- media/libcubeb/src/cubeb_alsa.c.orig 2017-09-14 20:16:05.000000000 +0000 +++ media/libcubeb/src/cubeb_alsa.c -@@ -12,6 +12,7 @@ +@@ -8,10 +8,12 @@ + #define _DEFAULT_SOURCE + #define _BSD_SOURCE + #define _XOPEN_SOURCE 500 ++#define _NETBSD_SOURCE + #include <pthread.h> #include <sys/time.h> #include <assert.h> #include <limits.h> @@ -13,7 +18,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon #include <poll.h> #include <unistd.h> #include <alsa/asoundlib.h> -@@ -26,6 +27,52 @@ +@@ -26,6 +28,52 @@ #define ALSA_PA_PLUGIN "ALSA <-> PulseAudio PCM I/O Plugin" @@ -66,7 +71,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon /* 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), -@@ -66,6 +113,8 @@ struct cubeb { +@@ -66,6 +114,8 @@ struct cubeb { workaround is not required. */ snd_config_t * local_config; int is_pa; @@ -75,7 +80,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon }; enum stream_state { -@@ -244,8 +293,8 @@ set_timeout(struct timeval * timeout, un +@@ -244,8 +294,8 @@ set_timeout(struct timeval * timeout, un static void stream_buffer_decrement(cubeb_stream * stm, long count) { @@ -86,7 +91,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon stm->bufframes -= count; } -@@ -277,9 +326,9 @@ alsa_process_stream(cubeb_stream * stm) +@@ -277,9 +327,9 @@ alsa_process_stream(cubeb_stream * stm) /* Call _poll_descriptors_revents() even if we don't use it to let underlying plugins clear null events. Otherwise poll() may wake up again and again, producing unnecessary CPU usage. */ @@ -98,7 +103,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon /* Got null event? Bail and wait for another wakeup. */ if (avail == 0) { -@@ -302,7 +351,7 @@ alsa_process_stream(cubeb_stream * stm) +@@ -302,7 +352,7 @@ alsa_process_stream(cubeb_stream * stm) // TODO: should it be marked as DRAINING? } @@ -107,7 +112,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon if (got < 0) { avail = got; // the error handler below will recover us -@@ -346,7 +395,7 @@ alsa_process_stream(cubeb_stream * stm) +@@ -346,7 +396,7 @@ alsa_process_stream(cubeb_stream * stm) (!stm->other_stream || stm->other_stream->bufframes > 0)) { long got = avail - stm->bufframes; void * other_buffer = stm->other_stream ? stm->other_stream->buffer : NULL; @@ -116,7 +121,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon /* Correct read size to the other stream available frames */ if (stm->other_stream && got > (snd_pcm_sframes_t) stm->other_stream->bufframes) { -@@ -373,8 +422,8 @@ alsa_process_stream(cubeb_stream * stm) +@@ -373,8 +423,8 @@ alsa_process_stream(cubeb_stream * stm) long drain_frames = avail - stm->bufframes; double drain_time = (double) drain_frames / stm->params.rate; @@ -127,7 +132,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon stm->bufframes = avail; /* Mark as draining, unless we're waiting for capture */ -@@ -401,7 +450,7 @@ alsa_process_stream(cubeb_stream * stm) +@@ -401,7 +451,7 @@ alsa_process_stream(cubeb_stream * stm) } } @@ -136,7 +141,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon if (wrote < 0) { avail = wrote; // the error handler below will recover us } else { -@@ -414,13 +463,13 @@ alsa_process_stream(cubeb_stream * stm) +@@ -414,13 +464,13 @@ alsa_process_stream(cubeb_stream * stm) /* Got some error? Let's try to recover the stream. */ if (avail < 0) { @@ -153,7 +158,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon } } -@@ -536,26 +585,26 @@ get_slave_pcm_node(snd_config_t * lconf, +@@ -536,26 +586,26 @@ get_slave_pcm_node(snd_config_t * lconf, slave_def = NULL; @@ -185,7 +190,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon if (r < 0) { break; } -@@ -564,7 +613,7 @@ get_slave_pcm_node(snd_config_t * lconf, +@@ -564,7 +614,7 @@ get_slave_pcm_node(snd_config_t * lconf, if (r < 0 || r > (int) sizeof(node_name)) { break; } @@ -194,7 +199,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon if (r < 0) { break; } -@@ -573,7 +622,7 @@ get_slave_pcm_node(snd_config_t * lconf, +@@ -573,7 +623,7 @@ get_slave_pcm_node(snd_config_t * lconf, } while (0); if (slave_def) { @@ -203,7 +208,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon } return NULL; -@@ -596,22 +645,22 @@ init_local_config_with_workaround(char c +@@ -596,22 +646,22 @@ init_local_config_with_workaround(char c lconf = NULL; @@ -230,7 +235,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon if (r < 0) { break; } -@@ -620,7 +669,7 @@ init_local_config_with_workaround(char c +@@ -620,7 +670,7 @@ init_local_config_with_workaround(char c if (r < 0 || r > (int) sizeof(node_name)) { break; } @@ -239,7 +244,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon if (r < 0) { break; } -@@ -631,12 +680,12 @@ init_local_config_with_workaround(char c +@@ -631,12 +681,12 @@ init_local_config_with_workaround(char c } /* Fetch the PCM node's type, and bail out if it's not the PulseAudio plugin. */ @@ -254,7 +259,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon if (r < 0) { break; } -@@ -647,18 +696,18 @@ init_local_config_with_workaround(char c +@@ -647,18 +697,18 @@ init_local_config_with_workaround(char c /* Don't clobber an explicit existing handle_underrun value, set it only if it doesn't already exist. */ @@ -276,7 +281,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon if (r < 0) { break; } -@@ -666,7 +715,7 @@ init_local_config_with_workaround(char c +@@ -666,7 +716,7 @@ init_local_config_with_workaround(char c return lconf; } while (0); @@ -285,7 +290,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon return NULL; } -@@ -678,9 +727,9 @@ alsa_locked_pcm_open(snd_pcm_t ** pcm, c +@@ -678,9 +728,9 @@ alsa_locked_pcm_open(snd_pcm_t ** pcm, c pthread_mutex_lock(&cubeb_alsa_mutex); if (local_config) { @@ -297,7 +302,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon } pthread_mutex_unlock(&cubeb_alsa_mutex); -@@ -693,7 +742,7 @@ alsa_locked_pcm_close(snd_pcm_t * pcm) +@@ -693,7 +743,7 @@ alsa_locked_pcm_close(snd_pcm_t * pcm) int r; pthread_mutex_lock(&cubeb_alsa_mutex); @@ -306,7 +311,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon pthread_mutex_unlock(&cubeb_alsa_mutex); return r; -@@ -756,12 +805,65 @@ alsa_init(cubeb ** context, char const * +@@ -756,12 +806,65 @@ alsa_init(cubeb ** context, char const * pthread_attr_t attr; snd_pcm_t * dummy; @@ -373,7 +378,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon cubeb_alsa_error_handler_set = 1; } pthread_mutex_unlock(&cubeb_alsa_mutex); -@@ -769,6 +871,8 @@ alsa_init(cubeb ** context, char const * +@@ -769,6 +872,8 @@ alsa_init(cubeb ** context, char const * ctx = calloc(1, sizeof(*ctx)); assert(ctx); @@ -382,7 +387,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon ctx->ops = &alsa_ops; r = pthread_mutex_init(&ctx->mutex, NULL); -@@ -818,7 +922,7 @@ alsa_init(cubeb ** context, char const * +@@ -818,7 +923,7 @@ alsa_init(cubeb ** context, char const * config fails with EINVAL, the PA PCM is too old for this workaround. */ if (r == -EINVAL) { pthread_mutex_lock(&cubeb_alsa_mutex); @@ -391,7 +396,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon pthread_mutex_unlock(&cubeb_alsa_mutex); ctx->local_config = NULL; } else if (r >= 0) { -@@ -858,9 +962,13 @@ alsa_destroy(cubeb * ctx) +@@ -858,9 +963,13 @@ alsa_destroy(cubeb * ctx) pthread_mutex_destroy(&ctx->mutex); free(ctx->fds); @@ -406,7 +411,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon pthread_mutex_unlock(&cubeb_alsa_mutex); } -@@ -943,7 +1051,7 @@ alsa_stream_init_single(cubeb * ctx, cub +@@ -943,7 +1052,7 @@ alsa_stream_init_single(cubeb * ctx, cub return CUBEB_ERROR; } @@ -415,7 +420,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon assert(r == 0); latency_us = latency_frames * 1e6 / stm->params.rate; -@@ -956,7 +1064,7 @@ alsa_stream_init_single(cubeb * ctx, cub +@@ -956,7 +1065,7 @@ alsa_stream_init_single(cubeb * ctx, cub latency_us = latency_us < min_latency ? min_latency: latency_us; } @@ -424,7 +429,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon stm->params.channels, stm->params.rate, 1, latency_us); if (r < 0) { -@@ -964,20 +1072,20 @@ alsa_stream_init_single(cubeb * ctx, cub +@@ -964,20 +1073,20 @@ alsa_stream_init_single(cubeb * ctx, cub return CUBEB_ERROR_INVALID_FORMAT; } @@ -449,7 +454,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon assert((nfds_t) r == stm->nfds); if (alsa_register_stream(ctx, stm) != 0) { -@@ -1049,7 +1157,7 @@ alsa_stream_destroy(cubeb_stream * stm) +@@ -1049,7 +1158,7 @@ alsa_stream_destroy(cubeb_stream * stm) pthread_mutex_lock(&stm->mutex); if (stm->pcm) { if (stm->state == DRAINING) { @@ -458,7 +463,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon } alsa_locked_pcm_close(stm->pcm); stm->pcm = NULL; -@@ -1095,12 +1203,12 @@ alsa_get_max_channel_count(cubeb * ctx, +@@ -1095,12 +1204,12 @@ alsa_get_max_channel_count(cubeb * ctx, assert(stm); @@ -473,7 +478,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon if (r < 0) { return CUBEB_ERROR; } -@@ -1121,34 +1229,34 @@ alsa_get_preferred_sample_rate(cubeb * c +@@ -1121,34 +1230,34 @@ alsa_get_preferred_sample_rate(cubeb * c /* get a pcm, disabling resampling, so we get a rate the * hardware/dmix/pulse/etc. supports. */ @@ -516,7 +521,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon return CUBEB_OK; } -@@ -1181,10 +1289,10 @@ alsa_stream_start(cubeb_stream * stm) +@@ -1181,10 +1290,10 @@ alsa_stream_start(cubeb_stream * stm) pthread_mutex_lock(&stm->mutex); /* Capture pcm must be started after initial setup/recover */ if (stm->stream_type == SND_PCM_STREAM_CAPTURE && @@ -530,7 +535,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon gettimeofday(&stm->last_activity, NULL); pthread_mutex_unlock(&stm->mutex); -@@ -1224,7 +1332,7 @@ alsa_stream_stop(cubeb_stream * stm) +@@ -1224,7 +1333,7 @@ alsa_stream_stop(cubeb_stream * stm) pthread_mutex_unlock(&ctx->mutex); pthread_mutex_lock(&stm->mutex); @@ -539,7 +544,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon pthread_mutex_unlock(&stm->mutex); return CUBEB_OK; -@@ -1240,8 +1348,8 @@ alsa_stream_get_position(cubeb_stream * +@@ -1240,8 +1349,8 @@ alsa_stream_get_position(cubeb_stream * pthread_mutex_lock(&stm->mutex); delay = -1; @@ -550,7 +555,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.24 2017/09/30 05:34:12 ryoon *position = stm->last_position; pthread_mutex_unlock(&stm->mutex); return CUBEB_OK; -@@ -1266,7 +1374,7 @@ alsa_stream_get_latency(cubeb_stream * s +@@ -1266,7 +1375,7 @@ alsa_stream_get_latency(cubeb_stream * s snd_pcm_sframes_t delay; /* This function returns the delay in frames until a frame written using snd_pcm_writei is sent to the DAC. The DAC delay should be < 1ms anyways. */ |