Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 10 Oct 2020 00:25:54 +0000 (UTC)
From:      Jan Beich <jbeich@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r551843 - in head: mail/thunderbird mail/thunderbird/files www/firefox www/firefox-esr www/firefox-esr/files www/firefox/files
Message-ID:  <202010100025.09A0PspP087605@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Sat Oct 10 00:25:54 2020
New Revision: 551843
URL: https://svnweb.freebsd.org/changeset/ports/551843

Log:
  gecko: update OSS patches
  
  Changes:	https://github.com/kinetiknz/cubeb/compare/cc85508...1f3771f

Modified:
  head/mail/thunderbird/Makefile   (contents, props changed)
  head/mail/thunderbird/files/patch-cubeb-oss   (contents, props changed)
  head/www/firefox-esr/Makefile   (contents, props changed)
  head/www/firefox-esr/files/patch-cubeb-oss   (contents, props changed)
  head/www/firefox/Makefile   (contents, props changed)
  head/www/firefox/files/patch-cubeb-oss   (contents, props changed)

Modified: head/mail/thunderbird/Makefile
==============================================================================
--- head/mail/thunderbird/Makefile	Sat Oct 10 00:25:46 2020	(r551842)
+++ head/mail/thunderbird/Makefile	Sat Oct 10 00:25:54 2020	(r551843)
@@ -3,7 +3,7 @@
 
 PORTNAME=	thunderbird
 DISTVERSION=	78.3.2
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	mail news net-im
 MASTER_SITES=	MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \
 		MOZILLA/${PORTNAME}/candidates/${DISTVERSION}-candidates/build1/source

Modified: head/mail/thunderbird/files/patch-cubeb-oss
==============================================================================
--- head/mail/thunderbird/files/patch-cubeb-oss	Sat Oct 10 00:25:46 2020	(r551842)
+++ head/mail/thunderbird/files/patch-cubeb-oss	Sat Oct 10 00:25:54 2020	(r551843)
@@ -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);

Modified: head/www/firefox-esr/Makefile
==============================================================================
--- head/www/firefox-esr/Makefile	Sat Oct 10 00:25:46 2020	(r551842)
+++ head/www/firefox-esr/Makefile	Sat Oct 10 00:25:54 2020	(r551843)
@@ -3,7 +3,7 @@
 
 PORTNAME=	firefox
 DISTVERSION=	78.3.1
-PORTREVISION=	1
+PORTREVISION=	2
 PORTEPOCH=	1
 CATEGORIES=	www
 MASTER_SITES=	MOZILLA/${PORTNAME}/releases/${DISTVERSION}esr/source \

Modified: head/www/firefox-esr/files/patch-cubeb-oss
==============================================================================
--- head/www/firefox-esr/files/patch-cubeb-oss	Sat Oct 10 00:25:46 2020	(r551842)
+++ head/www/firefox-esr/files/patch-cubeb-oss	Sat Oct 10 00:25:54 2020	(r551843)
@@ -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);

Modified: head/www/firefox/Makefile
==============================================================================
--- head/www/firefox/Makefile	Sat Oct 10 00:25:46 2020	(r551842)
+++ head/www/firefox/Makefile	Sat Oct 10 00:25:54 2020	(r551843)
@@ -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 \

Modified: head/www/firefox/files/patch-cubeb-oss
==============================================================================
--- head/www/firefox/files/patch-cubeb-oss	Sat Oct 10 00:25:46 2020	(r551842)
+++ head/www/firefox/files/patch-cubeb-oss	Sat Oct 10 00:25:54 2020	(r551843)
@@ -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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202010100025.09A0PspP087605>