diff options
author | tsutsui <tsutsui@pkgsrc.org> | 2017-06-30 16:45:05 +0000 |
---|---|---|
committer | tsutsui <tsutsui@pkgsrc.org> | 2017-06-30 16:45:05 +0000 |
commit | d1d4e1c71d5a607db98c93d1228649a96384d59d (patch) | |
tree | 9e7e8157d1dd1938de38a9149c9168781cd9d268 /www/firefox | |
parent | 969100e000724738380ad19d5082b82d29ac0793 (diff) | |
download | pkgsrc-d1d4e1c71d5a607db98c93d1228649a96384d59d.tar.gz |
Fix build with alsa option on NetBSD. PR/52310
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 4513aabfd40..5621b169582 100644 --- a/www/firefox/distinfo +++ b/www/firefox/distinfo @@ -1,4 +1,4 @@ -$NetBSD: distinfo,v 1.284 2017/06/30 16:36:18 tsutsui Exp $ +$NetBSD: distinfo,v 1.285 2017/06/30 16:45:05 tsutsui Exp $ SHA1 (firefox-54.0.source.tar.xz) = 44e40c77f58e3b203dc60f51c5a02993f6c38ee5 RMD160 (firefox-54.0.source.tar.xz) = 310f21498bc69939049d3ca881674a40fba8da21 @@ -60,7 +60,7 @@ SHA1 (patch-js_xpconnect_src_XPCConvert.cpp) = 915777e9bb5366be41866cdb6ea0ad2b1 SHA1 (patch-js_xpconnect_src_xpcprivate.h) = e09e37819961bae40a9f276ae1ee510d2956c23e SHA1 (patch-media_libcubeb_gtest_moz.build) = ebb4be6e6bca4a0ed6858516ec9fdb7828bbe2e1 SHA1 (patch-media_libcubeb_src_cubeb.c) = c689537aa7c3c40758d4b74e471e4dad1adeef5d -SHA1 (patch-media_libcubeb_src_cubeb__alsa.c) = bbd8796faaee52d9721bc406fb0a413b66ad9bc9 +SHA1 (patch-media_libcubeb_src_cubeb__alsa.c) = 8c99af543c49c23fea102c4ad9ffd617cc90631e SHA1 (patch-media_libcubeb_src_cubeb__oss.c) = 88cdfb9b9aa8c2607ca79bfa7fce4353e65638f7 SHA1 (patch-media_libcubeb_src_moz.build) = 59a2f95300b26c8047532c80445b958e7b8e738c SHA1 (patch-media_libcubeb_update.sh) = 7bd5145466c2af086a501be4e77432c0857236ce 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 e1241549e23..364290ab36f 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.22 2017/06/14 11:28:44 ryoon Exp $ +$NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.23 2017/06/30 16:45:05 tsutsui Exp $ * Support alsa audio under NetBSD * Avoid https://github.com/kinetiknz/cubeb/issues/226 --- media/libcubeb/src/cubeb_alsa.c.orig 2017-06-05 20:45:14.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.22 2017/06/14 11:28:44 ryoon #include <poll.h> #include <unistd.h> #include <alsa/asoundlib.h> -@@ -25,6 +26,52 @@ +@@ -25,6 +27,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.22 2017/06/14 11:28:44 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), -@@ -65,6 +112,8 @@ struct cubeb { +@@ -65,6 +113,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.22 2017/06/14 11:28:44 ryoon }; enum stream_state { -@@ -243,8 +292,8 @@ set_timeout(struct timeval * timeout, un +@@ -243,8 +293,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.22 2017/06/14 11:28:44 ryoon stm->bufframes -= count; } -@@ -276,9 +325,9 @@ alsa_process_stream(cubeb_stream * stm) +@@ -276,9 +326,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.22 2017/06/14 11:28:44 ryoon /* Got null event? Bail and wait for another wakeup. */ if (avail == 0) { -@@ -301,7 +350,7 @@ alsa_process_stream(cubeb_stream * stm) +@@ -301,7 +351,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.22 2017/06/14 11:28:44 ryoon if (got < 0) { avail = got; // the error handler below will recover us -@@ -345,7 +394,7 @@ alsa_process_stream(cubeb_stream * stm) +@@ -345,7 +395,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.22 2017/06/14 11:28:44 ryoon /* Correct read size to the other stream available frames */ if (stm->other_stream && got > (snd_pcm_sframes_t) stm->other_stream->bufframes) { -@@ -372,8 +421,8 @@ alsa_process_stream(cubeb_stream * stm) +@@ -372,8 +422,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.22 2017/06/14 11:28:44 ryoon stm->bufframes = avail; /* Mark as draining, unless we're waiting for capture */ -@@ -400,7 +449,7 @@ alsa_process_stream(cubeb_stream * stm) +@@ -400,7 +450,7 @@ alsa_process_stream(cubeb_stream * stm) } } @@ -136,7 +141,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.22 2017/06/14 11:28:44 ryoon if (wrote < 0) { avail = wrote; // the error handler below will recover us } else { -@@ -413,13 +462,13 @@ alsa_process_stream(cubeb_stream * stm) +@@ -413,13 +463,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.22 2017/06/14 11:28:44 ryoon } } -@@ -535,26 +584,26 @@ get_slave_pcm_node(snd_config_t * lconf, +@@ -535,26 +585,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.22 2017/06/14 11:28:44 ryoon if (r < 0) { break; } -@@ -563,7 +612,7 @@ get_slave_pcm_node(snd_config_t * lconf, +@@ -563,7 +613,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.22 2017/06/14 11:28:44 ryoon if (r < 0) { break; } -@@ -572,7 +621,7 @@ get_slave_pcm_node(snd_config_t * lconf, +@@ -572,7 +622,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.22 2017/06/14 11:28:44 ryoon } return NULL; -@@ -595,22 +644,22 @@ init_local_config_with_workaround(char c +@@ -595,22 +645,22 @@ init_local_config_with_workaround(char c lconf = NULL; @@ -230,7 +235,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.22 2017/06/14 11:28:44 ryoon if (r < 0) { break; } -@@ -619,7 +668,7 @@ init_local_config_with_workaround(char c +@@ -619,7 +669,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.22 2017/06/14 11:28:44 ryoon if (r < 0) { break; } -@@ -630,12 +679,12 @@ init_local_config_with_workaround(char c +@@ -630,12 +680,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.22 2017/06/14 11:28:44 ryoon if (r < 0) { break; } -@@ -646,18 +695,18 @@ init_local_config_with_workaround(char c +@@ -646,18 +696,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.22 2017/06/14 11:28:44 ryoon if (r < 0) { break; } -@@ -665,7 +714,7 @@ init_local_config_with_workaround(char c +@@ -665,7 +715,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.22 2017/06/14 11:28:44 ryoon return NULL; } -@@ -677,9 +726,9 @@ alsa_locked_pcm_open(snd_pcm_t ** pcm, c +@@ -677,9 +727,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.22 2017/06/14 11:28:44 ryoon } pthread_mutex_unlock(&cubeb_alsa_mutex); -@@ -692,7 +741,7 @@ alsa_locked_pcm_close(snd_pcm_t * pcm) +@@ -692,7 +742,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.22 2017/06/14 11:28:44 ryoon pthread_mutex_unlock(&cubeb_alsa_mutex); return r; -@@ -755,12 +804,65 @@ alsa_init(cubeb ** context, char const * +@@ -755,12 +805,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.22 2017/06/14 11:28:44 ryoon cubeb_alsa_error_handler_set = 1; } pthread_mutex_unlock(&cubeb_alsa_mutex); -@@ -768,6 +870,8 @@ alsa_init(cubeb ** context, char const * +@@ -768,6 +871,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.22 2017/06/14 11:28:44 ryoon ctx->ops = &alsa_ops; r = pthread_mutex_init(&ctx->mutex, NULL); -@@ -817,7 +921,7 @@ alsa_init(cubeb ** context, char const * +@@ -817,7 +922,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.22 2017/06/14 11:28:44 ryoon pthread_mutex_unlock(&cubeb_alsa_mutex); ctx->local_config = NULL; } else if (r >= 0) { -@@ -857,9 +961,13 @@ alsa_destroy(cubeb * ctx) +@@ -857,9 +962,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.22 2017/06/14 11:28:44 ryoon pthread_mutex_unlock(&cubeb_alsa_mutex); } -@@ -942,7 +1050,7 @@ alsa_stream_init_single(cubeb * ctx, cub +@@ -942,7 +1051,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.22 2017/06/14 11:28:44 ryoon assert(r == 0); latency_us = latency_frames * 1e6 / stm->params.rate; -@@ -955,7 +1063,7 @@ alsa_stream_init_single(cubeb * ctx, cub +@@ -955,7 +1064,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.22 2017/06/14 11:28:44 ryoon stm->params.channels, stm->params.rate, 1, latency_us); if (r < 0) { -@@ -963,20 +1071,20 @@ alsa_stream_init_single(cubeb * ctx, cub +@@ -963,20 +1072,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.22 2017/06/14 11:28:44 ryoon assert((nfds_t) r == stm->nfds); if (alsa_register_stream(ctx, stm) != 0) { -@@ -1048,7 +1156,7 @@ alsa_stream_destroy(cubeb_stream * stm) +@@ -1048,7 +1157,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.22 2017/06/14 11:28:44 ryoon } alsa_locked_pcm_close(stm->pcm); stm->pcm = NULL; -@@ -1094,12 +1202,12 @@ alsa_get_max_channel_count(cubeb * ctx, +@@ -1094,12 +1203,12 @@ alsa_get_max_channel_count(cubeb * ctx, assert(stm); @@ -473,7 +478,7 @@ $NetBSD: patch-media_libcubeb_src_cubeb__alsa.c,v 1.22 2017/06/14 11:28:44 ryoon if (r < 0) { return CUBEB_ERROR; } -@@ -1120,34 +1228,34 @@ alsa_get_preferred_sample_rate(cubeb * c +@@ -1120,34 +1229,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.22 2017/06/14 11:28:44 ryoon return CUBEB_OK; } -@@ -1180,10 +1288,10 @@ alsa_stream_start(cubeb_stream * stm) +@@ -1180,10 +1289,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.22 2017/06/14 11:28:44 ryoon gettimeofday(&stm->last_activity, NULL); pthread_mutex_unlock(&stm->mutex); -@@ -1223,7 +1331,7 @@ alsa_stream_stop(cubeb_stream * stm) +@@ -1223,7 +1332,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.22 2017/06/14 11:28:44 ryoon pthread_mutex_unlock(&stm->mutex); return CUBEB_OK; -@@ -1239,8 +1347,8 @@ alsa_stream_get_position(cubeb_stream * +@@ -1239,8 +1348,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.22 2017/06/14 11:28:44 ryoon *position = stm->last_position; pthread_mutex_unlock(&stm->mutex); return CUBEB_OK; -@@ -1265,7 +1373,7 @@ alsa_stream_get_latency(cubeb_stream * s +@@ -1265,7 +1374,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. */ |