aboutsummaryrefslogtreecommitdiff
path: root/www/firefox
diff options
context:
space:
mode:
authorJan Beich <jbeich@FreeBSD.org>2020-10-10 00:25:54 +0000
committerJan Beich <jbeich@FreeBSD.org>2020-10-10 00:25:54 +0000
commit585ede22e75a7c38d3350a20ea1f3f773e371b77 (patch)
tree3929eefebf214feef8f52acb01a778ba718c5d17 /www/firefox
parent93aef36e8f6433f5e728b4fd1bf839d42e9b56ef (diff)
downloadports-585ede22e75a7c38d3350a20ea1f3f773e371b77.tar.gz
ports-585ede22e75a7c38d3350a20ea1f3f773e371b77.zip
gecko: update OSS patches
Notes
Notes: svn path=/head/; revision=551843
Diffstat (limited to 'www/firefox')
-rw-r--r--www/firefox/Makefile2
-rw-r--r--www/firefox/files/patch-cubeb-oss96
2 files changed, 59 insertions, 39 deletions
diff --git a/www/firefox/Makefile b/www/firefox/Makefile
index f5560880581c..fcc03643f026 100644
--- a/www/firefox/Makefile
+++ b/www/firefox/Makefile
@@ -3,7 +3,7 @@
PORTNAME= firefox
DISTVERSION= 81.0.1
-PORTREVISION= 1
+PORTREVISION= 2
PORTEPOCH= 2
CATEGORIES= www
MASTER_SITES= MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \
diff --git a/www/firefox/files/patch-cubeb-oss b/www/firefox/files/patch-cubeb-oss
index 8e851f99273e..54a4c235fc3b 100644
--- a/www/firefox/files/patch-cubeb-oss
+++ b/www/firefox/files/patch-cubeb-oss
@@ -61,7 +61,7 @@ https://github.com/kinetiknz/cubeb/pull/600
#endif
--- /dev/null
+++ media/libcubeb/src/cubeb_oss.c
-@@ -0,0 +1,1242 @@
+@@ -0,0 +1,1262 @@
+/*
+ * Copyright © 2019-2020 Nia Alarie <nia@NetBSD.org>
+ * Copyright © 2020 Ka Ho Ng <khng300@gmail.com>
@@ -179,19 +179,20 @@ https://github.com/kinetiknz/cubeb/pull/600
+ struct cubeb * context;
+ void * user_ptr;
+ pthread_t thread;
-+ pthread_cond_t doorbell_cv;
-+ pthread_cond_t stopped_cv;
-+ /* protects doorbell_cv, stopped_cv, running, destroying, volume, frames_written */
-+ pthread_mutex_t mtx;
-+ bool thread_created;
-+ bool running;
-+ bool destroying;
-+ float volume;
++ bool doorbell; /* (m) */
++ pthread_cond_t doorbell_cv; /* (m) */
++ pthread_cond_t stopped_cv; /* (m) */
++ pthread_mutex_t mtx; /* Members protected by this should be marked (m) */
++ bool thread_created; /* (m) */
++ bool running; /* (m) */
++ bool destroying; /* (m) */
++ cubeb_state state;
++ float volume /* (m) */;
+ struct oss_stream play;
+ struct oss_stream record;
+ cubeb_data_callback data_cb;
+ cubeb_state_callback state_cb;
-+ uint64_t frames_written;
++ uint64_t frames_written /* (m) */;
+ unsigned int nfr; /* Number of frames allocated */
+ unsigned int nfrags;
+ unsigned int bufframes;
@@ -728,10 +729,16 @@ https://github.com/kinetiknz/cubeb/pull/600
+ pthread_mutex_lock(&s->mtx);
+ if (s->thread_created && s->running) {
+ s->running = false;
-+ pthread_cond_signal(&s->doorbell_cv);
++ s->doorbell = false;
+ pthread_cond_wait(&s->stopped_cv, &s->mtx);
+ }
-+ pthread_mutex_unlock(&s->mtx);
++ if (s->state != CUBEB_STATE_STOPPED) {
++ s->state = CUBEB_STATE_STOPPED;
++ pthread_mutex_unlock(&s->mtx);
++ s->state_cb(s, s->user_ptr, CUBEB_STATE_STOPPED);
++ } else {
++ pthread_mutex_unlock(&s->mtx);
++ }
+ return CUBEB_OK;
+}
+
@@ -741,6 +748,7 @@ https://github.com/kinetiknz/cubeb/pull/600
+ pthread_mutex_lock(&s->mtx);
+ if (s->thread_created) {
+ s->destroying = true;
++ s->doorbell = true;
+ pthread_cond_signal(&s->doorbell_cv);
+ }
+ pthread_mutex_unlock(&s->mtx);
@@ -800,10 +808,11 @@ https://github.com/kinetiknz/cubeb/pull/600
+ }
+}
+
++/* 1 - Stopped by cubeb_stream_stop, otherwise 0 */
+static int
-+oss_audio_loop(cubeb_stream * s)
++oss_audio_loop(cubeb_stream * s, cubeb_state *new_state)
+{
-+ int state = CUBEB_STATE_STARTED;
++ cubeb_state state = CUBEB_STATE_STOPPED;
+ int trig = 0;
+ int drain = 0;
+ struct pollfd pfds[2];
@@ -821,13 +830,13 @@ https://github.com/kinetiknz/cubeb/pull/600
+ if (ioctl(s->record.fd, SNDCTL_DSP_SETTRIGGER, &trig)) {
+ LOG("Error %d occured when setting trigger on record fd", errno);
+ state = CUBEB_STATE_ERROR;
-+ goto out;
++ goto breakdown;
+ }
+ trig |= PCM_ENABLE_INPUT;
+ if (ioctl(s->record.fd, SNDCTL_DSP_SETTRIGGER, &trig)) {
+ LOG("Error %d occured when setting trigger on record fd", errno);
+ state = CUBEB_STATE_ERROR;
-+ goto out;
++ goto breakdown;
+ }
+ memset(s->record.buf, 0, s->bufframes * s->record.frame_size);
+ }
@@ -838,7 +847,6 @@ https://github.com/kinetiknz/cubeb/pull/600
+ pthread_mutex_lock(&s->mtx);
+ if (!s->running || s->destroying) {
+ pthread_mutex_unlock(&s->mtx);
-+ state = CUBEB_STATE_STOPPED;
+ break;
+ }
+ pthread_mutex_unlock(&s->mtx);
@@ -848,8 +856,7 @@ https://github.com/kinetiknz/cubeb/pull/600
+ * play-only stream or record-only stream
+ */
+
-+ state = CUBEB_STATE_STOPPED;
-+ break;
++ goto breakdown;
+ }
+
+ while ((s->bufframes - ppending) >= s->nfr && rpending >= s->nfr) {
@@ -865,7 +872,7 @@ https://github.com/kinetiknz/cubeb/pull/600
+ nfr = s->data_cb(s, s->user_ptr, rptr, pptr, n);
+ if (nfr == CUBEB_ERROR) {
+ state = CUBEB_STATE_ERROR;
-+ goto out;
++ goto breakdown;
+ }
+ if (pptr) {
+ float vol;
@@ -902,7 +909,7 @@ https://github.com/kinetiknz/cubeb/pull/600
+ */
+
+ state = CUBEB_STATE_STOPPED;
-+ goto out;
++ goto breakdown;
+ }
+ }
+ }
@@ -919,7 +926,7 @@ https://github.com/kinetiknz/cubeb/pull/600
+ continue;
+ LOG("Error %d occured when polling playback and record fd", errno);
+ state = CUBEB_STATE_ERROR;
-+ goto out;
++ goto breakdown;
+ } else if (nfds == 0)
+ continue;
+
@@ -927,7 +934,7 @@ https://github.com/kinetiknz/cubeb/pull/600
+ (pfds[1].revents & (POLLERR | POLLHUP))) {
+ LOG("Error occured on playback, record fds");
+ state = CUBEB_STATE_ERROR;
-+ goto out;
++ goto breakdown;
+ }
+
+ if (pfds[0].revents) {
@@ -942,7 +949,7 @@ https://github.com/kinetiknz/cubeb/pull/600
+ break;
+ }
+ state = CUBEB_STATE_ERROR;
-+ goto out;
++ goto breakdown;
+ }
+ frames = n / s->play.frame_size;
+ pthread_mutex_lock(&s->mtx);
@@ -963,7 +970,7 @@ https://github.com/kinetiknz/cubeb/pull/600
+ if (errno == EAGAIN)
+ break;
+ state = CUBEB_STATE_ERROR;
-+ goto out;
++ goto breakdown;
+ }
+ frames = n / s->record.frame_size;
+ rpending += frames;
@@ -971,19 +978,26 @@ https://github.com/kinetiknz/cubeb/pull/600
+ }
+ if (drain) {
+ state = CUBEB_STATE_DRAINED;
-+ break;
++ goto breakdown;
+ }
+ }
+
-+out:
-+ return state;
++ return 1;
++
++breakdown:
++ pthread_mutex_lock(&s->mtx);
++ *new_state = s->state = state;
++ s->running = false;
++ pthread_mutex_unlock(&s->mtx);
++ return 0;
+}
+
+static void *
+oss_io_routine(void *arg)
+{
+ cubeb_stream *s = arg;
-+ cubeb_state state = CUBEB_STATE_STARTED;
++ cubeb_state new_state;
++ int stopped;
+
+ do {
+ pthread_mutex_lock(&s->mtx);
@@ -993,15 +1007,11 @@ https://github.com/kinetiknz/cubeb/pull/600
+ }
+ pthread_mutex_unlock(&s->mtx);
+
-+ state = CUBEB_STATE_STARTED;
-+ s->state_cb(s, s->user_ptr, state);
-+
-+ state = oss_audio_loop(s);
-+ assert(state != CUBEB_STATE_STARTED);
-+
++ stopped = oss_audio_loop(s, &new_state);
+ if (s->record.fd != -1)
+ ioctl(s->record.fd, SNDCTL_DSP_HALT_INPUT, NULL);
-+ s->state_cb(s, s->user_ptr, state);
++ if (!stopped)
++ s->state_cb(s, s->user_ptr, new_state);
+
+ pthread_mutex_lock(&s->mtx);
+ pthread_cond_signal(&s->stopped_cv);
@@ -1009,7 +1019,10 @@ https://github.com/kinetiknz/cubeb/pull/600
+ pthread_mutex_unlock(&s->mtx);
+ break;
+ }
-+ pthread_cond_wait(&s->doorbell_cv, &s->mtx);
++ while (!s->doorbell) {
++ pthread_cond_wait(&s->doorbell_cv, &s->mtx);
++ }
++ s->doorbell = false;
+ pthread_mutex_unlock(&s->mtx);
+ } while (1);
+
@@ -1169,6 +1182,7 @@ https://github.com/kinetiknz/cubeb/pull/600
+ LOG("Failed to create cv");
+ goto error;
+ }
++ s->doorbell = false;
+
+ if (s->play.fd != -1) {
+ if ((s->play.buf = calloc(s->bufframes, s->play.frame_size)) == NULL) {
@@ -1196,6 +1210,7 @@ https://github.com/kinetiknz/cubeb/pull/600
+oss_stream_thr_create(cubeb_stream * s)
+{
+ if (s->thread_created) {
++ s->doorbell = true;
+ pthread_cond_signal(&s->doorbell_cv);
+ return CUBEB_OK;
+ }
@@ -1211,11 +1226,16 @@ https://github.com/kinetiknz/cubeb/pull/600
+static int
+oss_stream_start(cubeb_stream * s)
+{
++ s->state_cb(s, s->user_ptr, CUBEB_STATE_STARTED);
+ pthread_mutex_lock(&s->mtx);
-+ if (!s->running && oss_stream_thr_create(s) != CUBEB_OK) {
++ /* Disallow starting an already started stream */
++ assert(!s->running && s->state != CUBEB_STATE_STARTED);
++ if (oss_stream_thr_create(s) != CUBEB_OK) {
+ pthread_mutex_unlock(&s->mtx);
++ s->state_cb(s, s->user_ptr, CUBEB_STATE_ERROR);
+ return CUBEB_ERROR;
+ }
++ s->state = CUBEB_STATE_STARTED;
+ s->thread_created = true;
+ s->running = true;
+ pthread_mutex_unlock(&s->mtx);