Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 Sep 2016 21:58:53 +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: r422465 - in head: mail/thunderbird mail/thunderbird/files www/firefox www/firefox-esr www/firefox-esr/files www/firefox/files www/libxul www/libxul/files www/seamonkey www/seamonkey/files
Message-ID:  <201609192158.u8JLwrhj066595@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: jbeich
Date: Mon Sep 19 21:58:53 2016
New Revision: 422465
URL: https://svnweb.freebsd.org/changeset/ports/422465

Log:
  gecko: update OSS fallback for HTML5 audio
  
  To test deinstall alsa-lib (and pulseaudio) after installing firefox/seamonkey/etc.
  Before OSS can be exposed as an option WebRTC has to either support it as well or
  pass build without any audio backends.
  
  Changes:	https://bugzilla.mozilla.org/show_bug.cgi?id=1021761#c67

Modified:
  head/mail/thunderbird/Makefile   (contents, props changed)
  head/mail/thunderbird/files/patch-bug1021761   (contents, props changed)
  head/www/firefox-esr/Makefile   (contents, props changed)
  head/www/firefox-esr/files/patch-bug1021761   (contents, props changed)
  head/www/firefox/Makefile   (contents, props changed)
  head/www/firefox/files/patch-bug1021761   (contents, props changed)
  head/www/libxul/Makefile   (contents, props changed)
  head/www/libxul/files/patch-bug1021761   (contents, props changed)
  head/www/seamonkey/Makefile   (contents, props changed)
  head/www/seamonkey/files/patch-bug1021761   (contents, props changed)

Modified: head/mail/thunderbird/Makefile
==============================================================================
--- head/mail/thunderbird/Makefile	Mon Sep 19 21:58:39 2016	(r422464)
+++ head/mail/thunderbird/Makefile	Mon Sep 19 21:58:53 2016	(r422465)
@@ -3,7 +3,7 @@
 
 PORTNAME=	thunderbird
 DISTVERSION=	45.3.0
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	mail news net-im ipv6
 MASTER_SITES=	MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \
 		MOZILLA/${PORTNAME}/candidates/${DISTVERSION}-candidates/build1/source

Modified: head/mail/thunderbird/files/patch-bug1021761
==============================================================================
--- head/mail/thunderbird/files/patch-bug1021761	Mon Sep 19 21:58:39 2016	(r422464)
+++ head/mail/thunderbird/files/patch-bug1021761	Mon Sep 19 21:58:53 2016	(r422465)
@@ -51,7 +51,7 @@ index 48e60c0..ec08417 100644
 +
 +    if test "$ac_cv_header_sys_soundcard_h" != "yes" -a \
 +            "$ac_cv_header_soundcard_h" != "yes"; then
-+        AC_MSG_ERROR([Need OSS for Ogg, Wave or WebM decoding on $OS_TARGET.  Disable with --disable-ogg --disable-wave --disable-webm.])
++        AC_MSG_ERROR([Need OSS for Ogg, Wave or WebM decoding on $OS_TARGET.  Disable with --without-oss.])
 +    fi
 +
 +    dnl Assume NetBSD implementation over SunAudio
@@ -643,7 +643,7 @@ new file mode 100644
 index 0000000..5e38e27
 --- /dev/null
 +++ mozilla/media/libcubeb/src/cubeb_oss.c
-@@ -0,0 +1,402 @@
+@@ -0,0 +1,432 @@
 +/*
 + * Copyright © 2014 Mozilla Foundation
 + *
@@ -769,8 +769,8 @@ index 0000000..5e38e27
 +  return got;
 +}
 +
-+static void apply_volume(int16_t* buffer, unsigned int n,
-+                         float volume, float panning)
++static void apply_volume_int(int16_t* buffer, unsigned int n,
++                             float volume, float panning)
 +{
 +  float left = volume;
 +  float right = volume;
@@ -788,6 +788,26 @@ index 0000000..5e38e27
 +  }
 +}
 +
++static void apply_volume_float(float* buffer, unsigned int n,
++                               float volume, float panning)
++{
++  float left = volume;
++  float right = volume;
++  unsigned int i;
++  float pan[2];
++  if (panning<0) {
++    right *= (1+panning);
++  } else {
++    left *= (1-panning);
++  }
++  pan[0] = left;
++  pan[1] = right;
++  for(i=0; i<n; i++){
++    buffer[i] = buffer[i]*pan[i%2];
++  }
++}
++
++
 +static void *writer(void *stm)
 +{
 +  cubeb_stream* stream = (cubeb_stream*)stm;
@@ -812,15 +832,25 @@ index 0000000..5e38e27
 +    if (stream->floating) {
 +      got = run_data_callback(stream, f_buffer,
 +                              OSS_BUFFER_SIZE/stream->params.channels);
++      apply_volume_float(f_buffer, got*stream->params.channels,
++                                   stream->volume, stream->panning);
 +      for (i=0; i<((unsigned long)got)*stream->params.channels; i++) {
-+          buffer[i] = f_buffer[i]*32767.0;
++        /* Clipping is prefered to overflow */
++	if(f_buffer[i]>=1.0){
++	  f_buffer[i]=1.0;
++	}
++        if(f_buffer[i]<=-1.0){
++	  f_buffer[i]=-1.0;
++	}
++        /* One might think that multipling by 32767.0 is logical but results in clipping */
++        buffer[i] = f_buffer[i]*32767.0;
 +      }
 +    } else {
 +      got = run_data_callback(stream, buffer,
 +                              OSS_BUFFER_SIZE/stream->params.channels);
++      apply_volume_int(buffer, got*stream->params.channels,
++                               stream->volume, stream->panning);
 +    }
-+    apply_volume(buffer, got*stream->params.channels,
-+                         stream->volume, stream->panning);
 +    if (got<0) {
 +      run_state_callback(stream, CUBEB_STATE_ERROR);
 +      break;
@@ -891,9 +921,9 @@ index 0000000..5e38e27
 +  oss_try_set_latency(stream, latency); 
 +
 +  stream->floating = 0;
-+  SET(SNDCTL_DSP_CHANNELS, stream_params.channels);
-+  SET(SNDCTL_DSP_SPEED, stream_params.rate);
-+  switch (stream_params.format) {
++  SET(SNDCTL_DSP_CHANNELS, stream->params.channels);
++  SET(SNDCTL_DSP_SPEED, stream->params.rate);
++  switch (stream->params.format) {
 +    case CUBEB_SAMPLE_S16LE:
 +      SET(SNDCTL_DSP_SETFMT, AFMT_S16_LE);
 +    break;
@@ -1070,6 +1100,31 @@ index 8b7a0dd..31212ce 100644
 +CFLAGS += CONFIG['MOZ_OSS_CFLAGS']
  CFLAGS += CONFIG['MOZ_ALSA_CFLAGS']
  CFLAGS += CONFIG['MOZ_PULSEAUDIO_CFLAGS']
+ 
+diff --git media/libcubeb/tests/moz.build media/libcubeb/tests/moz.build
+index 1b17c7b..48b56c2 100644
+--- mozilla/media/libcubeb/tests/moz.build
++++ mozilla/media/libcubeb/tests/moz.build
+@@ -73,7 +73,6 @@ elif CONFIG['OS_TARGET'] == 'OpenBSD':
+         'sndio',
+     ]
+ else:
+-    OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
+     OS_LIBS += CONFIG['MOZ_PULSEAUDIO_LIBS']
+ 
+ if CONFIG['GNU_CXX']:
+diff --git media/libcubeb/update.sh media/libcubeb/update.sh
+index a96badd..2f9585e 100755
+--- mozilla/media/libcubeb/update.sh
++++ mozilla/media/libcubeb/update.sh
+@@ -10,6 +10,7 @@ cp $1/src/cubeb_audiounit.c src
+ cp $1/src/cubeb_pulse.c src
+ cp $1/src/cubeb_sndio.c src
+ cp $1/src/cubeb_opensl.c src
++cp $1/src/cubeb_oss.c src
+ cp $1/src/cubeb_audiotrack.c src
+ cp $1/src/cubeb_wasapi.cpp src
+ cp $1/src/cubeb_resampler.h src
 diff --git media/webrtc/signaling/test/common.build media/webrtc/signaling/test/common.build
 index 991f03f..3d99eb5 100644
 --- mozilla/media/webrtc/signaling/test/common.build

Modified: head/www/firefox-esr/Makefile
==============================================================================
--- head/www/firefox-esr/Makefile	Mon Sep 19 21:58:39 2016	(r422464)
+++ head/www/firefox-esr/Makefile	Mon Sep 19 21:58:53 2016	(r422465)
@@ -4,7 +4,7 @@
 PORTNAME=	firefox
 DISTVERSION=	45.4.0
 DISTVERSIONSUFFIX=esr.source
-PORTREVISION=	2
+PORTREVISION=	3
 PORTEPOCH=	1
 CATEGORIES=	www ipv6
 MASTER_SITES=	MOZILLA/${PORTNAME}/releases/${DISTVERSION}esr/source \

Modified: head/www/firefox-esr/files/patch-bug1021761
==============================================================================
--- head/www/firefox-esr/files/patch-bug1021761	Mon Sep 19 21:58:39 2016	(r422464)
+++ head/www/firefox-esr/files/patch-bug1021761	Mon Sep 19 21:58:53 2016	(r422465)
@@ -51,7 +51,7 @@ index 48e60c0..ec08417 100644
 +
 +    if test "$ac_cv_header_sys_soundcard_h" != "yes" -a \
 +            "$ac_cv_header_soundcard_h" != "yes"; then
-+        AC_MSG_ERROR([Need OSS for Ogg, Wave or WebM decoding on $OS_TARGET.  Disable with --disable-ogg --disable-wave --disable-webm.])
++        AC_MSG_ERROR([Need OSS for Ogg, Wave or WebM decoding on $OS_TARGET.  Disable with --without-oss.])
 +    fi
 +
 +    dnl Assume NetBSD implementation over SunAudio
@@ -643,7 +643,7 @@ new file mode 100644
 index 0000000..5e38e27
 --- /dev/null
 +++ media/libcubeb/src/cubeb_oss.c
-@@ -0,0 +1,402 @@
+@@ -0,0 +1,432 @@
 +/*
 + * Copyright © 2014 Mozilla Foundation
 + *
@@ -769,8 +769,8 @@ index 0000000..5e38e27
 +  return got;
 +}
 +
-+static void apply_volume(int16_t* buffer, unsigned int n,
-+                         float volume, float panning)
++static void apply_volume_int(int16_t* buffer, unsigned int n,
++                             float volume, float panning)
 +{
 +  float left = volume;
 +  float right = volume;
@@ -788,6 +788,26 @@ index 0000000..5e38e27
 +  }
 +}
 +
++static void apply_volume_float(float* buffer, unsigned int n,
++                               float volume, float panning)
++{
++  float left = volume;
++  float right = volume;
++  unsigned int i;
++  float pan[2];
++  if (panning<0) {
++    right *= (1+panning);
++  } else {
++    left *= (1-panning);
++  }
++  pan[0] = left;
++  pan[1] = right;
++  for(i=0; i<n; i++){
++    buffer[i] = buffer[i]*pan[i%2];
++  }
++}
++
++
 +static void *writer(void *stm)
 +{
 +  cubeb_stream* stream = (cubeb_stream*)stm;
@@ -812,15 +832,25 @@ index 0000000..5e38e27
 +    if (stream->floating) {
 +      got = run_data_callback(stream, f_buffer,
 +                              OSS_BUFFER_SIZE/stream->params.channels);
++      apply_volume_float(f_buffer, got*stream->params.channels,
++                                   stream->volume, stream->panning);
 +      for (i=0; i<((unsigned long)got)*stream->params.channels; i++) {
-+          buffer[i] = f_buffer[i]*32767.0;
++        /* Clipping is prefered to overflow */
++	if(f_buffer[i]>=1.0){
++	  f_buffer[i]=1.0;
++	}
++        if(f_buffer[i]<=-1.0){
++	  f_buffer[i]=-1.0;
++	}
++        /* One might think that multipling by 32767.0 is logical but results in clipping */
++        buffer[i] = f_buffer[i]*32767.0;
 +      }
 +    } else {
 +      got = run_data_callback(stream, buffer,
 +                              OSS_BUFFER_SIZE/stream->params.channels);
++      apply_volume_int(buffer, got*stream->params.channels,
++                               stream->volume, stream->panning);
 +    }
-+    apply_volume(buffer, got*stream->params.channels,
-+                         stream->volume, stream->panning);
 +    if (got<0) {
 +      run_state_callback(stream, CUBEB_STATE_ERROR);
 +      break;
@@ -891,9 +921,9 @@ index 0000000..5e38e27
 +  oss_try_set_latency(stream, latency); 
 +
 +  stream->floating = 0;
-+  SET(SNDCTL_DSP_CHANNELS, stream_params.channels);
-+  SET(SNDCTL_DSP_SPEED, stream_params.rate);
-+  switch (stream_params.format) {
++  SET(SNDCTL_DSP_CHANNELS, stream->params.channels);
++  SET(SNDCTL_DSP_SPEED, stream->params.rate);
++  switch (stream->params.format) {
 +    case CUBEB_SAMPLE_S16LE:
 +      SET(SNDCTL_DSP_SETFMT, AFMT_S16_LE);
 +    break;
@@ -1070,6 +1100,31 @@ index 8b7a0dd..31212ce 100644
 +CFLAGS += CONFIG['MOZ_OSS_CFLAGS']
  CFLAGS += CONFIG['MOZ_ALSA_CFLAGS']
  CFLAGS += CONFIG['MOZ_PULSEAUDIO_CFLAGS']
+ 
+diff --git media/libcubeb/tests/moz.build media/libcubeb/tests/moz.build
+index 1b17c7b..48b56c2 100644
+--- media/libcubeb/tests/moz.build
++++ media/libcubeb/tests/moz.build
+@@ -73,7 +73,6 @@ elif CONFIG['OS_TARGET'] == 'OpenBSD':
+         'sndio',
+     ]
+ else:
+-    OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
+     OS_LIBS += CONFIG['MOZ_PULSEAUDIO_LIBS']
+ 
+ if CONFIG['GNU_CXX']:
+diff --git media/libcubeb/update.sh media/libcubeb/update.sh
+index a96badd..2f9585e 100755
+--- media/libcubeb/update.sh
++++ media/libcubeb/update.sh
+@@ -10,6 +10,7 @@ cp $1/src/cubeb_audiounit.c src
+ cp $1/src/cubeb_pulse.c src
+ cp $1/src/cubeb_sndio.c src
+ cp $1/src/cubeb_opensl.c src
++cp $1/src/cubeb_oss.c src
+ cp $1/src/cubeb_audiotrack.c src
+ cp $1/src/cubeb_wasapi.cpp src
+ cp $1/src/cubeb_resampler.h src
 diff --git media/webrtc/signaling/test/common.build media/webrtc/signaling/test/common.build
 index 991f03f..3d99eb5 100644
 --- media/webrtc/signaling/test/common.build

Modified: head/www/firefox/Makefile
==============================================================================
--- head/www/firefox/Makefile	Mon Sep 19 21:58:39 2016	(r422464)
+++ head/www/firefox/Makefile	Mon Sep 19 21:58:53 2016	(r422465)
@@ -4,7 +4,7 @@
 PORTNAME=	firefox
 DISTVERSION=	49.0
 DISTVERSIONSUFFIX=.source
-PORTREVISION=	4
+PORTREVISION=	5
 PORTEPOCH=	1
 CATEGORIES=	www ipv6
 MASTER_SITES=	MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \

Modified: head/www/firefox/files/patch-bug1021761
==============================================================================
--- head/www/firefox/files/patch-bug1021761	Mon Sep 19 21:58:39 2016	(r422464)
+++ head/www/firefox/files/patch-bug1021761	Mon Sep 19 21:58:53 2016	(r422465)
@@ -23,7 +23,7 @@ index 48e60c0..ec08417 100644
 +
 +dnl If using Linux, Solaris or BSDs, ensure that OSS is available
 +case "$OS_TARGET" in
-+Linux|SunOS|DragonFly|FreeBSD|GNU/kFreeBSD)
++Linux|SunOS|DragonFly|FreeBSD|NetBSD|GNU/kFreeBSD)
 +    MOZ_OSS=1
 +    ;;
 +esac
@@ -63,7 +63,7 @@ index 48e60c0..ec08417 100644
 +
 +    if test "$ac_cv_header_sys_soundcard_h" != "yes" -a \
 +            "$ac_cv_header_soundcard_h" != "yes"; then
-+        AC_MSG_ERROR([Need OSS for Ogg, Wave or WebM decoding on $OS_TARGET.  Disable with --disable-ogg --disable-wave --disable-webm.])
++        AC_MSG_ERROR([Need OSS for Ogg, Wave or WebM decoding on $OS_TARGET.  Disable with --without-oss.])
 +    fi
 +
 +    dnl Assume NetBSD implementation over SunAudio
@@ -653,7 +653,7 @@ new file mode 100644
 index 0000000..5e38e27
 --- /dev/null
 +++ media/libcubeb/src/cubeb_oss.c
-@@ -0,0 +1,412 @@
+@@ -0,0 +1,442 @@
 +/*
 + * Copyright © 2014 Mozilla Foundation
 + *
@@ -780,8 +780,8 @@ index 0000000..5e38e27
 +  return got;
 +}
 +
-+static void apply_volume(int16_t* buffer, unsigned int n,
-+                         float volume, float panning)
++static void apply_volume_int(int16_t* buffer, unsigned int n,
++                             float volume, float panning)
 +{
 +  float left = volume;
 +  float right = volume;
@@ -799,6 +799,26 @@ index 0000000..5e38e27
 +  }
 +}
 +
++static void apply_volume_float(float* buffer, unsigned int n,
++                               float volume, float panning)
++{
++  float left = volume;
++  float right = volume;
++  unsigned int i;
++  float pan[2];
++  if (panning<0) {
++    right *= (1+panning);
++  } else {
++    left *= (1-panning);
++  }
++  pan[0] = left;
++  pan[1] = right;
++  for(i=0; i<n; i++){
++    buffer[i] = buffer[i]*pan[i%2];
++  }
++}
++
++
 +static void *writer(void *stm)
 +{
 +  cubeb_stream* stream = (cubeb_stream*)stm;
@@ -823,15 +843,25 @@ index 0000000..5e38e27
 +    if (stream->floating) {
 +      got = run_data_callback(stream, f_buffer,
 +                              OSS_BUFFER_SIZE/stream->params.channels);
++      apply_volume_float(f_buffer, got*stream->params.channels,
++                                   stream->volume, stream->panning);
 +      for (i=0; i<((unsigned long)got)*stream->params.channels; i++) {
-+          buffer[i] = f_buffer[i]*32767.0;
++        /* Clipping is prefered to overflow */
++	if(f_buffer[i]>=1.0){
++	  f_buffer[i]=1.0;
++	}
++        if(f_buffer[i]<=-1.0){
++	  f_buffer[i]=-1.0;
++	}
++        /* One might think that multipling by 32767.0 is logical but results in clipping */
++        buffer[i] = f_buffer[i]*32767.0;
 +      }
 +    } else {
 +      got = run_data_callback(stream, buffer,
 +                              OSS_BUFFER_SIZE/stream->params.channels);
++      apply_volume_int(buffer, got*stream->params.channels,
++                               stream->volume, stream->panning);
 +    }
-+    apply_volume(buffer, got*stream->params.channels,
-+                         stream->volume, stream->panning);
 +    if (got<0) {
 +      run_state_callback(stream, CUBEB_STATE_ERROR);
 +      break;
@@ -911,9 +941,9 @@ index 0000000..5e38e27
 +  oss_try_set_latency(stream, latency); 
 +
 +  stream->floating = 0;
-+  SET(SNDCTL_DSP_CHANNELS, output_stream_params->channels);
-+  SET(SNDCTL_DSP_SPEED, output_stream_params->rate);
-+  switch (output_stream_params->format) {
++  SET(SNDCTL_DSP_CHANNELS, stream->params.channels);
++  SET(SNDCTL_DSP_SPEED, stream->params.rate);
++  switch (stream->params.format) {
 +    case CUBEB_SAMPLE_S16LE:
 +      SET(SNDCTL_DSP_SETFMT, AFMT_S16_LE);
 +    break;
@@ -1090,6 +1120,31 @@ index 8b7a0dd..31212ce 100644
 +CFLAGS += CONFIG['MOZ_OSS_CFLAGS']
  CFLAGS += CONFIG['MOZ_ALSA_CFLAGS']
  CFLAGS += CONFIG['MOZ_PULSEAUDIO_CFLAGS']
+ 
+diff --git media/libcubeb/tests/moz.build media/libcubeb/tests/moz.build
+index 1b17c7b..48b56c2 100644
+--- media/libcubeb/tests/moz.build
++++ media/libcubeb/tests/moz.build
+@@ -73,7 +73,6 @@ elif CONFIG['OS_TARGET'] == 'OpenBSD':
+         'sndio',
+     ]
+ else:
+-    OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
+     OS_LIBS += CONFIG['MOZ_PULSEAUDIO_LIBS']
+ 
+ if CONFIG['GNU_CXX']:
+diff --git media/libcubeb/update.sh media/libcubeb/update.sh
+index a96badd..2f9585e 100755
+--- media/libcubeb/update.sh
++++ media/libcubeb/update.sh
+@@ -10,6 +10,7 @@ cp $1/src/cubeb_audiounit.c src
+ cp $1/src/cubeb_pulse.c src
+ cp $1/src/cubeb_sndio.c src
+ cp $1/src/cubeb_opensl.c src
++cp $1/src/cubeb_oss.c src
+ cp $1/src/cubeb_audiotrack.c src
+ cp $1/src/cubeb_wasapi.cpp src
+ cp $1/src/cubeb_resampler.h src
 diff --git media/webrtc/signaling/test/common.build media/webrtc/signaling/test/common.build
 index 991f03f..3d99eb5 100644
 --- media/webrtc/signaling/test/common.build

Modified: head/www/libxul/Makefile
==============================================================================
--- head/www/libxul/Makefile	Mon Sep 19 21:58:39 2016	(r422464)
+++ head/www/libxul/Makefile	Mon Sep 19 21:58:53 2016	(r422465)
@@ -3,7 +3,7 @@
 
 PORTNAME=	libxul
 DISTVERSION=	45.4.0
-PORTREVISION=	2
+PORTREVISION=	3
 CATEGORIES?=	www devel
 MASTER_SITES=	MOZILLA/firefox/releases/${DISTVERSION}esr/source \
 		MOZILLA/firefox/candidates/${DISTVERSION}esr-candidates/build2/source

Modified: head/www/libxul/files/patch-bug1021761
==============================================================================
--- head/www/libxul/files/patch-bug1021761	Mon Sep 19 21:58:39 2016	(r422464)
+++ head/www/libxul/files/patch-bug1021761	Mon Sep 19 21:58:53 2016	(r422465)
@@ -51,7 +51,7 @@ index 48e60c0..ec08417 100644
 +
 +    if test "$ac_cv_header_sys_soundcard_h" != "yes" -a \
 +            "$ac_cv_header_soundcard_h" != "yes"; then
-+        AC_MSG_ERROR([Need OSS for Ogg, Wave or WebM decoding on $OS_TARGET.  Disable with --disable-ogg --disable-wave --disable-webm.])
++        AC_MSG_ERROR([Need OSS for Ogg, Wave or WebM decoding on $OS_TARGET.  Disable with --without-oss.])
 +    fi
 +
 +    dnl Assume NetBSD implementation over SunAudio
@@ -643,7 +643,7 @@ new file mode 100644
 index 0000000..5e38e27
 --- /dev/null
 +++ media/libcubeb/src/cubeb_oss.c
-@@ -0,0 +1,402 @@
+@@ -0,0 +1,432 @@
 +/*
 + * Copyright © 2014 Mozilla Foundation
 + *
@@ -769,8 +769,8 @@ index 0000000..5e38e27
 +  return got;
 +}
 +
-+static void apply_volume(int16_t* buffer, unsigned int n,
-+                         float volume, float panning)
++static void apply_volume_int(int16_t* buffer, unsigned int n,
++                             float volume, float panning)
 +{
 +  float left = volume;
 +  float right = volume;
@@ -788,6 +788,26 @@ index 0000000..5e38e27
 +  }
 +}
 +
++static void apply_volume_float(float* buffer, unsigned int n,
++                               float volume, float panning)
++{
++  float left = volume;
++  float right = volume;
++  unsigned int i;
++  float pan[2];
++  if (panning<0) {
++    right *= (1+panning);
++  } else {
++    left *= (1-panning);
++  }
++  pan[0] = left;
++  pan[1] = right;
++  for(i=0; i<n; i++){
++    buffer[i] = buffer[i]*pan[i%2];
++  }
++}
++
++
 +static void *writer(void *stm)
 +{
 +  cubeb_stream* stream = (cubeb_stream*)stm;
@@ -812,15 +832,25 @@ index 0000000..5e38e27
 +    if (stream->floating) {
 +      got = run_data_callback(stream, f_buffer,
 +                              OSS_BUFFER_SIZE/stream->params.channels);
++      apply_volume_float(f_buffer, got*stream->params.channels,
++                                   stream->volume, stream->panning);
 +      for (i=0; i<((unsigned long)got)*stream->params.channels; i++) {
-+          buffer[i] = f_buffer[i]*32767.0;
++        /* Clipping is prefered to overflow */
++	if(f_buffer[i]>=1.0){
++	  f_buffer[i]=1.0;
++	}
++        if(f_buffer[i]<=-1.0){
++	  f_buffer[i]=-1.0;
++	}
++        /* One might think that multipling by 32767.0 is logical but results in clipping */
++        buffer[i] = f_buffer[i]*32767.0;
 +      }
 +    } else {
 +      got = run_data_callback(stream, buffer,
 +                              OSS_BUFFER_SIZE/stream->params.channels);
++      apply_volume_int(buffer, got*stream->params.channels,
++                               stream->volume, stream->panning);
 +    }
-+    apply_volume(buffer, got*stream->params.channels,
-+                         stream->volume, stream->panning);
 +    if (got<0) {
 +      run_state_callback(stream, CUBEB_STATE_ERROR);
 +      break;
@@ -891,9 +921,9 @@ index 0000000..5e38e27
 +  oss_try_set_latency(stream, latency); 
 +
 +  stream->floating = 0;
-+  SET(SNDCTL_DSP_CHANNELS, stream_params.channels);
-+  SET(SNDCTL_DSP_SPEED, stream_params.rate);
-+  switch (stream_params.format) {
++  SET(SNDCTL_DSP_CHANNELS, stream->params.channels);
++  SET(SNDCTL_DSP_SPEED, stream->params.rate);
++  switch (stream->params.format) {
 +    case CUBEB_SAMPLE_S16LE:
 +      SET(SNDCTL_DSP_SETFMT, AFMT_S16_LE);
 +    break;
@@ -1070,6 +1100,31 @@ index 8b7a0dd..31212ce 100644
 +CFLAGS += CONFIG['MOZ_OSS_CFLAGS']
  CFLAGS += CONFIG['MOZ_ALSA_CFLAGS']
  CFLAGS += CONFIG['MOZ_PULSEAUDIO_CFLAGS']
+ 
+diff --git media/libcubeb/tests/moz.build media/libcubeb/tests/moz.build
+index 1b17c7b..48b56c2 100644
+--- media/libcubeb/tests/moz.build
++++ media/libcubeb/tests/moz.build
+@@ -73,7 +73,6 @@ elif CONFIG['OS_TARGET'] == 'OpenBSD':
+         'sndio',
+     ]
+ else:
+-    OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
+     OS_LIBS += CONFIG['MOZ_PULSEAUDIO_LIBS']
+ 
+ if CONFIG['GNU_CXX']:
+diff --git media/libcubeb/update.sh media/libcubeb/update.sh
+index a96badd..2f9585e 100755
+--- media/libcubeb/update.sh
++++ media/libcubeb/update.sh
+@@ -10,6 +10,7 @@ cp $1/src/cubeb_audiounit.c src
+ cp $1/src/cubeb_pulse.c src
+ cp $1/src/cubeb_sndio.c src
+ cp $1/src/cubeb_opensl.c src
++cp $1/src/cubeb_oss.c src
+ cp $1/src/cubeb_audiotrack.c src
+ cp $1/src/cubeb_wasapi.cpp src
+ cp $1/src/cubeb_resampler.h src
 diff --git media/webrtc/signaling/test/common.build media/webrtc/signaling/test/common.build
 index 991f03f..3d99eb5 100644
 --- media/webrtc/signaling/test/common.build

Modified: head/www/seamonkey/Makefile
==============================================================================
--- head/www/seamonkey/Makefile	Mon Sep 19 21:58:39 2016	(r422464)
+++ head/www/seamonkey/Makefile	Mon Sep 19 21:58:53 2016	(r422465)
@@ -4,7 +4,7 @@
 PORTNAME=	seamonkey
 DISTVERSION=	2.39
 MOZILLA_VER=	42 # above + 3
-PORTREVISION=	12
+PORTREVISION=	13
 CATEGORIES?=	www mail news editors irc ipv6
 MASTER_SITES=	MOZILLA/${PORTNAME}/releases/${DISTVERSION}/source \
 		MOZILLA/${PORTNAME}/candidates/${DISTVERSION}-candidates/build1/source

Modified: head/www/seamonkey/files/patch-bug1021761
==============================================================================
--- head/www/seamonkey/files/patch-bug1021761	Mon Sep 19 21:58:39 2016	(r422464)
+++ head/www/seamonkey/files/patch-bug1021761	Mon Sep 19 21:58:53 2016	(r422465)
@@ -51,7 +51,7 @@ index 48e60c0..ec08417 100644
 +
 +    if test "$ac_cv_header_sys_soundcard_h" != "yes" -a \
 +            "$ac_cv_header_soundcard_h" != "yes"; then
-+        AC_MSG_ERROR([Need OSS for Ogg, Wave or WebM decoding on $OS_TARGET.  Disable with --disable-ogg --disable-wave --disable-webm.])
++        AC_MSG_ERROR([Need OSS for Ogg, Wave or WebM decoding on $OS_TARGET.  Disable with --without-oss.])
 +    fi
 +
 +    dnl Assume NetBSD implementation over SunAudio
@@ -562,7 +562,7 @@ index a962553..1f780f4 100644
    /* get a pcm, disabling resampling, so we get a rate the
     * hardware/dmix/pulse/etc. supports. */
 -  r = snd_pcm_open(&pcm, "default", SND_PCM_STREAM_PLAYBACK | SND_PCM_NO_AUTO_RESAMPLE, 0);
-+  r = WRAP(snd_pcm_open)(&pcm, "default", SND_PCM_STREAM_PLAYBACK | SND_PCM_NO_AUTO_RESAMPLE, 0);
++  r = WRAP(snd_pcm_open)(&pcm, CUBEB_ALSA_PCM_NAME, SND_PCM_STREAM_PLAYBACK | SND_PCM_NO_AUTO_RESAMPLE, 0);
    if (r < 0) {
      return CUBEB_ERROR;
    }
@@ -643,7 +643,7 @@ new file mode 100644
 index 0000000..5e38e27
 --- /dev/null
 +++ mozilla/media/libcubeb/src/cubeb_oss.c
-@@ -0,0 +1,402 @@
+@@ -0,0 +1,432 @@
 +/*
 + * Copyright © 2014 Mozilla Foundation
 + *
@@ -769,8 +769,8 @@ index 0000000..5e38e27
 +  return got;
 +}
 +
-+static void apply_volume(int16_t* buffer, unsigned int n,
-+                         float volume, float panning)
++static void apply_volume_int(int16_t* buffer, unsigned int n,
++                             float volume, float panning)
 +{
 +  float left = volume;
 +  float right = volume;
@@ -788,6 +788,26 @@ index 0000000..5e38e27
 +  }
 +}
 +
++static void apply_volume_float(float* buffer, unsigned int n,
++                               float volume, float panning)
++{
++  float left = volume;
++  float right = volume;
++  unsigned int i;
++  float pan[2];
++  if (panning<0) {
++    right *= (1+panning);
++  } else {
++    left *= (1-panning);
++  }
++  pan[0] = left;
++  pan[1] = right;
++  for(i=0; i<n; i++){
++    buffer[i] = buffer[i]*pan[i%2];
++  }
++}
++
++
 +static void *writer(void *stm)
 +{
 +  cubeb_stream* stream = (cubeb_stream*)stm;
@@ -812,15 +832,25 @@ index 0000000..5e38e27
 +    if (stream->floating) {
 +      got = run_data_callback(stream, f_buffer,
 +                              OSS_BUFFER_SIZE/stream->params.channels);
++      apply_volume_float(f_buffer, got*stream->params.channels,
++                                   stream->volume, stream->panning);
 +      for (i=0; i<((unsigned long)got)*stream->params.channels; i++) {
-+          buffer[i] = f_buffer[i]*32767.0;
++        /* Clipping is prefered to overflow */
++	if(f_buffer[i]>=1.0){
++	  f_buffer[i]=1.0;
++	}
++        if(f_buffer[i]<=-1.0){
++	  f_buffer[i]=-1.0;
++	}
++        /* One might think that multipling by 32767.0 is logical but results in clipping */
++        buffer[i] = f_buffer[i]*32767.0;
 +      }
 +    } else {
 +      got = run_data_callback(stream, buffer,
 +                              OSS_BUFFER_SIZE/stream->params.channels);
++      apply_volume_int(buffer, got*stream->params.channels,
++                               stream->volume, stream->panning);
 +    }
-+    apply_volume(buffer, got*stream->params.channels,
-+                         stream->volume, stream->panning);
 +    if (got<0) {
 +      run_state_callback(stream, CUBEB_STATE_ERROR);
 +      break;
@@ -891,9 +921,9 @@ index 0000000..5e38e27
 +  oss_try_set_latency(stream, latency); 
 +
 +  stream->floating = 0;
-+  SET(SNDCTL_DSP_CHANNELS, stream_params.channels);
-+  SET(SNDCTL_DSP_SPEED, stream_params.rate);
-+  switch (stream_params.format) {
++  SET(SNDCTL_DSP_CHANNELS, stream->params.channels);
++  SET(SNDCTL_DSP_SPEED, stream->params.rate);
++  switch (stream->params.format) {
 +    case CUBEB_SAMPLE_S16LE:
 +      SET(SNDCTL_DSP_SETFMT, AFMT_S16_LE);
 +    break;
@@ -1070,6 +1100,31 @@ index 8b7a0dd..31212ce 100644
 +CFLAGS += CONFIG['MOZ_OSS_CFLAGS']
  CFLAGS += CONFIG['MOZ_ALSA_CFLAGS']
  CFLAGS += CONFIG['MOZ_PULSEAUDIO_CFLAGS']
+ 
+diff --git media/libcubeb/tests/moz.build media/libcubeb/tests/moz.build
+index 1b17c7b..48b56c2 100644
+--- mozilla/media/libcubeb/tests/moz.build
++++ mozilla/media/libcubeb/tests/moz.build
+@@ -73,7 +73,6 @@ elif CONFIG['OS_TARGET'] == 'OpenBSD':
+         'sndio',
+     ]
+ else:
+-    OS_LIBS += CONFIG['MOZ_ALSA_LIBS']
+     OS_LIBS += CONFIG['MOZ_PULSEAUDIO_LIBS']
+ 
+ if CONFIG['GNU_CXX']:
+diff --git media/libcubeb/update.sh media/libcubeb/update.sh
+index a96badd..2f9585e 100755
+--- mozilla/media/libcubeb/update.sh
++++ mozilla/media/libcubeb/update.sh
+@@ -10,6 +10,7 @@ cp $1/src/cubeb_audiounit.c src
+ cp $1/src/cubeb_pulse.c src
+ cp $1/src/cubeb_sndio.c src
+ cp $1/src/cubeb_opensl.c src
++cp $1/src/cubeb_oss.c src
+ cp $1/src/cubeb_audiotrack.c src
+ cp $1/src/cubeb_wasapi.cpp src
+ cp $1/src/cubeb_resampler.h src
 diff --git media/webrtc/signaling/test/common.build media/webrtc/signaling/test/common.build
 index 991f03f..3d99eb5 100644
 --- mozilla/media/webrtc/signaling/test/common.build



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