summaryrefslogtreecommitdiff
path: root/www/firefox/files/patch-bug1021761
diff options
context:
space:
mode:
Diffstat (limited to 'www/firefox/files/patch-bug1021761')
-rw-r--r--www/firefox/files/patch-bug1021761293
1 files changed, 179 insertions, 114 deletions
diff --git a/www/firefox/files/patch-bug1021761 b/www/firefox/files/patch-bug1021761
index a73bd09f6dc9..e59fce618f00 100644
--- a/www/firefox/files/patch-bug1021761
+++ b/www/firefox/files/patch-bug1021761
@@ -1,20 +1,20 @@
diff --git build/moz.configure/old.configure build/moz.configure/old.configure
-index b95dd2b..4cbefd5 100644
+index cd6c37cf4c7c..e98dc7973a6a 100644
--- build/moz.configure/old.configure
+++ build/moz.configure/old.configure
-@@ -305,6 +305,7 @@ def old_configure_options(*options):
+@@ -275,6 +275,7 @@ def old_configure_options(*options):
'--with-nspr-prefix',
'--with-nss-exec-prefix',
'--with-nss-prefix',
+ '--with-oss',
'--with-pthreads',
'--with-qemu-exe',
- '--with-servo',
-diff --git old-configure.in configure.in
-index 48e60c0..ec08417 100644
+ '--with-sixgill',
+diff --git old-configure.in old-configure.in
+index dff46614635e..dbbfdb76ab78 100644
--- old-configure.in
+++ old-configure.in
-@@ -5591,6 +5591,67 @@ fi
+@@ -3128,6 +3128,67 @@ AC_DEFINE(MOZ_WEBM_ENCODER)
AC_SUBST(MOZ_WEBM_ENCODER)
dnl ==================================
@@ -82,32 +82,49 @@ index 48e60c0..ec08417 100644
dnl = Check alsa availability on Linux
dnl ==================================
+diff --git dom/media/CubebUtils.cpp dom/media/CubebUtils.cpp
+index e10e07e06ade..1fd561bea113 100644
+--- dom/media/CubebUtils.cpp
++++ dom/media/CubebUtils.cpp
+@@ -71,7 +71,8 @@ const char* AUDIOSTREAM_BACKEND_ID_STR[] = {
+ "sndio",
+ "opensl",
+ "audiotrack",
+- "kai"
++ "kai",
++ "oss",
+ };
+ /* Index for failures to create an audio stream the first time. */
+ const int CUBEB_BACKEND_INIT_FAILURE_FIRST =
diff --git media/libcubeb/AUTHORS media/libcubeb/AUTHORS
-index b441e8a..950d9e5 100644
+index 0fde65baad34..f8663c43b475 100644
--- media/libcubeb/AUTHORS
+++ media/libcubeb/AUTHORS
-@@ -4,3 +4,4 @@ Michael Wu <mwu@mozilla.com>
+@@ -4,6 +4,7 @@ Michael Wu <mwu@mozilla.com>
Paul Adenot <paul@paul.cx>
David Richards <drichards@mozilla.com>
Sebastien Alaiwan <sebastien.alaiwan@gmail.com>
+Evgeniy Vodolazskiy <waterlaz@gmail.com>
+ KO Myung-Hun <komh@chollian.net>
+ Haakon Sporsheim <haakon.sporsheim@telenordigital.com>
+ Alex Chronopoulos <achronop@gmail.com>
diff --git media/libcubeb/src/cubeb.c media/libcubeb/src/cubeb.c
-index 9c3adcc..45d765b 100644
+index 57bcb4c13652..68be024f4a68 100644
--- media/libcubeb/src/cubeb.c
+++ media/libcubeb/src/cubeb.c
-@@ -54,6 +54,9 @@ int opensl_init(cubeb ** context, char const * context_name);
- #if defined(USE_AUDIOTRACK)
- int audiotrack_init(cubeb ** context, char const * context_name);
+@@ -54,6 +54,9 @@ int audiotrack_init(cubeb ** context, char const * context_name);
+ #if defined(USE_KAI)
+ int kai_init(cubeb ** context, char const * context_name);
#endif
+#if defined(USE_OSS)
+int oss_init(cubeb ** context, char const * context_name);
+#endif
- int
- validate_stream_params(cubeb_stream_params stream_params)
-@@ -120,6 +123,9 @@ cubeb_init(cubeb ** context, char const * context_name)
- #if defined(USE_AUDIOTRACK)
- audiotrack_init,
+ static int
+ validate_stream_params(cubeb_stream_params * input_stream_params,
+@@ -138,6 +141,9 @@ cubeb_init(cubeb ** context, char const * context_name)
+ #if defined(USE_KAI)
+ kai_init,
#endif
+#if defined(USE_OSS)
+ oss_init,
@@ -116,10 +133,10 @@ index 9c3adcc..45d765b 100644
int i;
diff --git media/libcubeb/src/cubeb_alsa.c media/libcubeb/src/cubeb_alsa.c
-index a962553..1f780f4 100644
+index 05ad27fef53b..3ea78e994f59 100644
--- media/libcubeb/src/cubeb_alsa.c
+++ media/libcubeb/src/cubeb_alsa.c
-@@ -11,6 +11,7 @@
+@@ -12,6 +12,7 @@
#include <sys/time.h>
#include <assert.h>
#include <limits.h>
@@ -127,7 +144,7 @@ index a962553..1f780f4 100644
#include <poll.h>
#include <unistd.h>
#include <alsa/asoundlib.h>
-@@ -24,6 +25,50 @@
+@@ -25,6 +26,52 @@
#define ALSA_PA_PLUGIN "ALSA <-> PulseAudio PCM I/O Plugin"
@@ -167,8 +184,10 @@ index a962553..1f780f4 100644
+MAKE_TYPEDEF(snd_pcm_poll_descriptors);
+MAKE_TYPEDEF(snd_pcm_poll_descriptors_count);
+MAKE_TYPEDEF(snd_pcm_poll_descriptors_revents);
++MAKE_TYPEDEF(snd_pcm_readi);
+MAKE_TYPEDEF(snd_pcm_recover);
+MAKE_TYPEDEF(snd_pcm_set_params);
++MAKE_TYPEDEF(snd_pcm_start);
+MAKE_TYPEDEF(snd_pcm_state);
+MAKE_TYPEDEF(snd_pcm_writei);
+
@@ -178,7 +197,7 @@ index a962553..1f780f4 100644
/* 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),
-@@ -64,6 +109,8 @@ struct cubeb {
+@@ -65,6 +112,8 @@ struct cubeb {
workaround is not required. */
snd_config_t * local_config;
int is_pa;
@@ -187,53 +206,85 @@ index a962553..1f780f4 100644
};
enum stream_state {
-@@ -260,10 +307,10 @@ alsa_refill_stream(cubeb_stream * stm)
+@@ -243,8 +292,8 @@ set_timeout(struct timeval * timeout, unsigned int ms)
+ static void
+ stream_buffer_decrement(cubeb_stream * stm, long count)
+ {
+- char * bufremains = stm->buffer + snd_pcm_frames_to_bytes(stm->pcm, count);
+- memmove(stm->buffer, bufremains, snd_pcm_frames_to_bytes(stm->pcm, stm->bufframes - count));
++ char * bufremains = stm->buffer + WRAP(snd_pcm_frames_to_bytes)(stm->pcm, count);
++ memmove(stm->buffer, bufremains, WRAP(snd_pcm_frames_to_bytes)(stm->pcm, stm->bufframes - count));
+ stm->bufframes -= count;
+ }
- pthread_mutex_lock(&stm->mutex);
+@@ -276,9 +325,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. */
+- snd_pcm_poll_descriptors_revents(stm->pcm, stm->fds, stm->nfds, &revents);
++ WRAP(snd_pcm_poll_descriptors_revents)(stm->pcm, stm->fds, stm->nfds, &revents);
- avail = snd_pcm_avail_update(stm->pcm);
+ avail = WRAP(snd_pcm_avail_update)(stm->pcm);
- if (avail < 0) {
-- snd_pcm_recover(stm->pcm, avail, 1);
-- avail = snd_pcm_avail_update(stm->pcm);
-+ WRAP(snd_pcm_recover)(stm->pcm, avail, 1);
-+ avail = WRAP(snd_pcm_avail_update)(stm->pcm);
- }
- /* Failed to recover from an xrun, this stream must be broken. */
-@@ -286,7 +333,7 @@ alsa_refill_stream(cubeb_stream * stm)
- return RUNNING;
- }
-
-- p = calloc(1, snd_pcm_frames_to_bytes(stm->pcm, avail));
-+ p = calloc(1, WRAP(snd_pcm_frames_to_bytes)(stm->pcm, avail));
- assert(p);
+ /* Got null event? Bail and wait for another wakeup. */
+ if (avail == 0) {
+@@ -301,7 +350,7 @@ alsa_process_stream(cubeb_stream * stm)
+ // TODO: should it be marked as DRAINING?
+ }
- pthread_mutex_unlock(&stm->mutex);
-@@ -312,10 +359,10 @@ alsa_refill_stream(cubeb_stream * stm)
- b[i] *= stm->volume;
+- got = snd_pcm_readi(stm->pcm, stm->buffer+stm->bufframes, avail);
++ got = WRAP(snd_pcm_readi)(stm->pcm, stm->buffer+stm->bufframes, avail);
+
+ if (got < 0) {
+ avail = got; // the error handler below will recover us
+@@ -345,7 +394,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;
+- char * buftail = stm->buffer + snd_pcm_frames_to_bytes(stm->pcm, stm->bufframes);
++ char * buftail = stm->buffer + WRAP(snd_pcm_frames_to_bytes)(stm->pcm, stm->bufframes);
+
+ /* Correct read size to the other stream available frames */
+ if (stm->other_stream && got > stm->other_stream->bufframes) {
+@@ -372,8 +421,8 @@ alsa_process_stream(cubeb_stream * stm)
+ long drain_frames = avail - stm->bufframes;
+ double drain_time = (double) drain_frames / stm->params.rate;
+
+- char * buftail = stm->buffer + snd_pcm_frames_to_bytes(stm->pcm, stm->bufframes);
+- memset(buftail, 0, snd_pcm_frames_to_bytes(stm->pcm, drain_frames));
++ char * buftail = stm->buffer + WRAP(snd_pcm_frames_to_bytes)(stm->pcm, stm->bufframes);
++ memset(buftail, 0, WRAP(snd_pcm_frames_to_bytes)(stm->pcm, drain_frames));
+ stm->bufframes = avail;
+
+ /* Mark as draining, unless we're waiting for capture */
+@@ -400,7 +449,7 @@ alsa_process_stream(cubeb_stream * stm)
}
}
-- wrote = snd_pcm_writei(stm->pcm, p, got);
-+ wrote = WRAP(snd_pcm_writei)(stm->pcm, p, got);
- if (wrote < 0) {
-- snd_pcm_recover(stm->pcm, wrote, 1);
-- wrote = snd_pcm_writei(stm->pcm, p, got);
-+ WRAP(snd_pcm_recover)(stm->pcm, wrote, 1);
-+ wrote = WRAP(snd_pcm_writei)(stm->pcm, p, got);
- }
- assert(wrote >= 0 && wrote == got);
- stm->write_position += wrote;
-@@ -342,7 +389,7 @@ alsa_refill_stream(cubeb_stream * stm)
- /* Fill the remaining buffer with silence to guarantee one full period
- has been written. */
-- snd_pcm_writei(stm->pcm, (char *) p + got, avail - got);
-+ WRAP(snd_pcm_writei)(stm->pcm, (char *) p + got, avail - got);
+- wrote = snd_pcm_writei(stm->pcm, stm->buffer, avail);
++ wrote = WRAP(snd_pcm_writei)(stm->pcm, stm->buffer, avail);
+ if (wrote < 0) {
+ avail = wrote; // the error handler below will recover us
+ } else {
+@@ -413,13 +462,13 @@ alsa_process_stream(cubeb_stream * stm)
- set_timeout(&stm->drain_timeout, buffer_time * 1000);
+ /* Got some error? Let's try to recover the stream. */
+ if (avail < 0) {
+- avail = snd_pcm_recover(stm->pcm, avail, 0);
++ avail = WRAP(snd_pcm_recover)(stm->pcm, avail, 0);
+
+ /* Capture pcm must be started after initial setup/recover */
+ if (avail >= 0 &&
+ stm->stream_type == SND_PCM_STREAM_CAPTURE &&
+- snd_pcm_state(stm->pcm) == SND_PCM_STATE_PREPARED) {
+- avail = snd_pcm_start(stm->pcm);
++ WRAP(snd_pcm_state)(stm->pcm) == SND_PCM_STATE_PREPARED) {
++ avail = WRAP(snd_pcm_start)(stm->pcm);
+ }
+ }
-@@ -453,26 +500,26 @@ get_slave_pcm_node(snd_config_t * lconf, snd_config_t * root_pcm)
+@@ -535,26 +584,26 @@ get_slave_pcm_node(snd_config_t * lconf, snd_config_t * root_pcm)
slave_def = NULL;
@@ -265,7 +316,7 @@ index a962553..1f780f4 100644
if (r < 0) {
break;
}
-@@ -481,7 +528,7 @@ get_slave_pcm_node(snd_config_t * lconf, snd_config_t * root_pcm)
+@@ -563,7 +612,7 @@ get_slave_pcm_node(snd_config_t * lconf, snd_config_t * root_pcm)
if (r < 0 || r > (int) sizeof(node_name)) {
break;
}
@@ -274,7 +325,7 @@ index a962553..1f780f4 100644
if (r < 0) {
break;
}
-@@ -490,7 +537,7 @@ get_slave_pcm_node(snd_config_t * lconf, snd_config_t * root_pcm)
+@@ -572,7 +621,7 @@ get_slave_pcm_node(snd_config_t * lconf, snd_config_t * root_pcm)
} while (0);
if (slave_def) {
@@ -283,7 +334,7 @@ index a962553..1f780f4 100644
}
return NULL;
-@@ -513,22 +560,22 @@ init_local_config_with_workaround(char const * pcm_name)
+@@ -595,22 +644,22 @@ init_local_config_with_workaround(char const * pcm_name)
lconf = NULL;
@@ -310,7 +361,7 @@ index a962553..1f780f4 100644
if (r < 0) {
break;
}
-@@ -537,7 +584,7 @@ init_local_config_with_workaround(char const * pcm_name)
+@@ -619,7 +668,7 @@ init_local_config_with_workaround(char const * pcm_name)
if (r < 0 || r > (int) sizeof(node_name)) {
break;
}
@@ -319,7 +370,7 @@ index a962553..1f780f4 100644
if (r < 0) {
break;
}
-@@ -548,12 +595,12 @@ init_local_config_with_workaround(char const * pcm_name)
+@@ -630,12 +679,12 @@ init_local_config_with_workaround(char const * pcm_name)
}
/* Fetch the PCM node's type, and bail out if it's not the PulseAudio plugin. */
@@ -334,7 +385,7 @@ index a962553..1f780f4 100644
if (r < 0) {
break;
}
-@@ -564,18 +611,18 @@ init_local_config_with_workaround(char const * pcm_name)
+@@ -646,18 +695,18 @@ init_local_config_with_workaround(char const * pcm_name)
/* Don't clobber an explicit existing handle_underrun value, set it only
if it doesn't already exist. */
@@ -356,7 +407,7 @@ index a962553..1f780f4 100644
if (r < 0) {
break;
}
-@@ -583,7 +630,7 @@ init_local_config_with_workaround(char const * pcm_name)
+@@ -665,7 +714,7 @@ init_local_config_with_workaround(char const * pcm_name)
return lconf;
} while (0);
@@ -365,19 +416,19 @@ index a962553..1f780f4 100644
return NULL;
}
-@@ -595,9 +642,9 @@ alsa_locked_pcm_open(snd_pcm_t ** pcm, snd_pcm_stream_t stream, snd_config_t * l
+@@ -677,9 +726,9 @@ alsa_locked_pcm_open(snd_pcm_t ** pcm, char const * pcm_name, snd_pcm_stream_t s
pthread_mutex_lock(&cubeb_alsa_mutex);
if (local_config) {
-- r = snd_pcm_open_lconf(pcm, CUBEB_ALSA_PCM_NAME, stream, SND_PCM_NONBLOCK, local_config);
-+ r = WRAP(snd_pcm_open_lconf)(pcm, CUBEB_ALSA_PCM_NAME, stream, SND_PCM_NONBLOCK, local_config);
+- r = snd_pcm_open_lconf(pcm, pcm_name, stream, SND_PCM_NONBLOCK, local_config);
++ r = WRAP(snd_pcm_open_lconf)(pcm, pcm_name, stream, SND_PCM_NONBLOCK, local_config);
} else {
-- r = snd_pcm_open(pcm, CUBEB_ALSA_PCM_NAME, stream, SND_PCM_NONBLOCK);
-+ r = WRAP(snd_pcm_open)(pcm, CUBEB_ALSA_PCM_NAME, stream, SND_PCM_NONBLOCK);
+- r = snd_pcm_open(pcm, pcm_name, stream, SND_PCM_NONBLOCK);
++ r = WRAP(snd_pcm_open)(pcm, pcm_name, stream, SND_PCM_NONBLOCK);
}
pthread_mutex_unlock(&cubeb_alsa_mutex);
-@@ -610,7 +657,7 @@ alsa_locked_pcm_close(snd_pcm_t * pcm)
+@@ -692,7 +741,7 @@ alsa_locked_pcm_close(snd_pcm_t * pcm)
int r;
pthread_mutex_lock(&cubeb_alsa_mutex);
@@ -386,7 +437,7 @@ index a962553..1f780f4 100644
pthread_mutex_unlock(&cubeb_alsa_mutex);
return r;
-@@ -667,12 +714,65 @@ alsa_init(cubeb ** context, char const * context_name)
+@@ -755,12 +804,65 @@ alsa_init(cubeb ** context, char const * context_name)
pthread_attr_t attr;
snd_pcm_t * dummy;
@@ -453,7 +504,7 @@ index a962553..1f780f4 100644
cubeb_alsa_error_handler_set = 1;
}
pthread_mutex_unlock(&cubeb_alsa_mutex);
-@@ -680,6 +780,8 @@ alsa_init(cubeb ** context, char const * context_name)
+@@ -768,6 +870,8 @@ alsa_init(cubeb ** context, char const * context_name)
ctx = calloc(1, sizeof(*ctx));
assert(ctx);
@@ -462,7 +513,7 @@ index a962553..1f780f4 100644
ctx->ops = &alsa_ops;
r = pthread_mutex_init(&ctx->mutex, NULL);
-@@ -729,7 +831,7 @@ alsa_init(cubeb ** context, char const * context_name)
+@@ -817,7 +921,7 @@ alsa_init(cubeb ** context, char const * context_name)
config fails with EINVAL, the PA PCM is too old for this workaround. */
if (r == -EINVAL) {
pthread_mutex_lock(&cubeb_alsa_mutex);
@@ -471,7 +522,7 @@ index a962553..1f780f4 100644
pthread_mutex_unlock(&cubeb_alsa_mutex);
ctx->local_config = NULL;
} else if (r >= 0) {
-@@ -768,9 +870,13 @@ alsa_destroy(cubeb * ctx)
+@@ -857,9 +961,13 @@ alsa_destroy(cubeb * ctx)
pthread_mutex_destroy(&ctx->mutex);
free(ctx->fds);
@@ -486,7 +537,7 @@ index a962553..1f780f4 100644
pthread_mutex_unlock(&cubeb_alsa_mutex);
}
-@@ -838,7 +944,7 @@ alsa_stream_init(cubeb * ctx, cubeb_stream ** stream, char const * stream_name,
+@@ -939,7 +1047,7 @@ alsa_stream_init_single(cubeb * ctx, cubeb_stream ** stream, char const * stream
return CUBEB_ERROR;
}
@@ -495,7 +546,7 @@ index a962553..1f780f4 100644
assert(r == 0);
latency_us = latency_frames * 1e6 / stm->params.rate;
-@@ -855,7 +961,7 @@ alsa_stream_init(cubeb * ctx, cubeb_stre
+@@ -952,7 +1060,7 @@ alsa_stream_init_single(cubeb * ctx, cubeb_stream ** stream, char const * stream
latency_us = latency_us < min_latency ? min_latency: latency_us;
}
@@ -504,7 +555,7 @@ index a962553..1f780f4 100644
stm->params.channels, stm->params.rate, 1,
latency_us);
if (r < 0) {
-@@ -867,15 +973,15 @@ alsa_stream_init(cubeb * ctx, cubeb_stre
+@@ -960,20 +1068,20 @@ alsa_stream_init_single(cubeb * ctx, cubeb_stream ** stream, char const * stream
return CUBEB_ERROR_INVALID_FORMAT;
}
@@ -512,6 +563,12 @@ index a962553..1f780f4 100644
+ r = WRAP(snd_pcm_get_params)(stm->pcm, &stm->buffer_size, &period_size);
assert(r == 0);
+ /* Double internal buffer size to have enough space when waiting for the other side of duplex connection */
+ stm->buffer_size *= 2;
+- stm->buffer = calloc(1, snd_pcm_frames_to_bytes(stm->pcm, stm->buffer_size));
++ stm->buffer = calloc(1, WRAP(snd_pcm_frames_to_bytes)(stm->pcm, stm->buffer_size));
+ assert(stm->buffer);
+
- stm->nfds = snd_pcm_poll_descriptors_count(stm->pcm);
+ stm->nfds = WRAP(snd_pcm_poll_descriptors_count)(stm->pcm);
assert(stm->nfds > 0);
@@ -523,7 +580,7 @@ index a962553..1f780f4 100644
assert((nfds_t) r == stm->nfds);
r = pthread_cond_init(&stm->cond, NULL);
-@@ -895,7 +1001,7 @@ alsa_stream_destroy(cubeb_stream * stm)
+@@ -1048,7 +1156,7 @@ alsa_stream_destroy(cubeb_stream * stm)
pthread_mutex_lock(&stm->mutex);
if (stm->pcm) {
if (stm->state == DRAINING) {
@@ -532,9 +589,9 @@ index a962553..1f780f4 100644
}
alsa_locked_pcm_close(stm->pcm);
stm->pcm = NULL;
-@@ -938,12 +1044,12 @@ alsa_get_max_channel_count(cubeb * ctx, uint32_t * max_channels)
- return CUBEB_ERROR;
- }
+@@ -1094,12 +1202,12 @@ alsa_get_max_channel_count(cubeb * ctx, uint32_t * max_channels)
+
+ assert(stm);
- r = snd_pcm_hw_params_any(stm->pcm, hw_params);
+ r = WRAP(snd_pcm_hw_params_any)(stm->pcm, hw_params);
@@ -547,7 +604,7 @@ index a962553..1f780f4 100644
if (r < 0) {
return CUBEB_ERROR;
}
-@@ -969,34 +1075,34 @@ alsa_get_preferred_sample_rate(cubeb * c
+@@ -1120,34 +1228,34 @@ alsa_get_preferred_sample_rate(cubeb * ctx, uint32_t * rate) {
/* get a pcm, disabling resampling, so we get a rate the
* hardware/dmix/pulse/etc. supports. */
@@ -590,16 +647,21 @@ index a962553..1f780f4 100644
return CUBEB_OK;
}
-@@ -1013,7 +1119,7 @@ alsa_stream_start(cubeb_stream * stm)
- ctx = stm->context;
-
+@@ -1180,10 +1288,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 &&
+- snd_pcm_state(stm->pcm) == SND_PCM_STATE_PREPARED) {
+- snd_pcm_start(stm->pcm);
++ WRAP(snd_pcm_state)(stm->pcm) == SND_PCM_STATE_PREPARED) {
++ WRAP(snd_pcm_start)(stm->pcm);
+ }
- snd_pcm_pause(stm->pcm, 0);
+ WRAP(snd_pcm_pause)(stm->pcm, 0);
gettimeofday(&stm->last_activity, NULL);
pthread_mutex_unlock(&stm->mutex);
-@@ -1047,7 +1153,7 @@ alsa_stream_stop(cubeb_stream * stm)
+@@ -1223,7 +1331,7 @@ alsa_stream_stop(cubeb_stream * stm)
pthread_mutex_unlock(&ctx->mutex);
pthread_mutex_lock(&stm->mutex);
@@ -608,7 +670,7 @@ index a962553..1f780f4 100644
pthread_mutex_unlock(&stm->mutex);
return CUBEB_OK;
-@@ -1063,8 +1169,8 @@ alsa_stream_get_position(cubeb_stream * stm, uint64_t * position)
+@@ -1239,8 +1347,8 @@ alsa_stream_get_position(cubeb_stream * stm, uint64_t * position)
pthread_mutex_lock(&stm->mutex);
delay = -1;
@@ -619,7 +681,7 @@ index a962553..1f780f4 100644
*position = stm->last_position;
pthread_mutex_unlock(&stm->mutex);
return CUBEB_OK;
-@@ -1089,7 +1195,7 @@ alsa_stream_get_latency(cubeb_stream * stm, uint32_t * latency)
+@@ -1265,7 +1373,7 @@ alsa_stream_get_latency(cubeb_stream * stm, uint32_t * latency)
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. */
@@ -630,10 +692,10 @@ index a962553..1f780f4 100644
diff --git media/libcubeb/src/cubeb_oss.c media/libcubeb/src/cubeb_oss.c
new file mode 100644
-index 0000000..5e38e27
+index 000000000000..7b0b4f37dbe4
--- /dev/null
+++ media/libcubeb/src/cubeb_oss.c
-@@ -0,0 +1,442 @@
+@@ -0,0 +1,445 @@
+/*
+ * Copyright © 2014 Mozilla Foundation
+ *
@@ -725,10 +787,11 @@ index 0000000..5e38e27
+}
+
+static int oss_get_min_latency(cubeb * context, cubeb_stream_params params,
-+ uint32_t * latency_ms)
++ uint32_t * latency_frames)
+{
++ (void)context;
+ /* 40ms is a big enough number to work ok */
-+ *latency_ms = 40;
++ *latency_frames = 40 * params.rate / 1000;
+ return CUBEB_OK;
+}
+
@@ -871,8 +934,7 @@ index 0000000..5e38e27
+ unsigned int latency_bytes, n_frag;
+ int frag;
+ /* fragment size of 1024 is a good choice with good chances to be accepted */
-+ unsigned int frag_size=1024;
-+ unsigned int frag_log=10; /* 2^frag_log = frag_size */
++ unsigned int frag_log=10; /* 2^frag_log = fragment size */
+ latency_bytes =
+ latency*stream->params.rate*stream->params.channels*sizeof(uint16_t)/1000;
+ n_frag = latency_bytes>>frag_log;
@@ -1063,7 +1125,9 @@ index 0000000..5e38e27
+ .get_max_channel_count = oss_get_max_channel_count,
+ .get_min_latency = oss_get_min_latency,
+ .get_preferred_sample_rate = oss_get_preferred_sample_rate,
++ .get_preferred_channel_layout = NULL,
+ .destroy = oss_destroy,
++ .enumerate_devices = NULL,
+ .stream_init = oss_stream_init,
+ .stream_destroy = oss_stream_destroy,
+ .stream_start = oss_stream_start,
@@ -1074,13 +1138,14 @@ index 0000000..5e38e27
+ .stream_set_panning = oss_stream_set_panning,
+ .stream_get_current_device = NULL,
+ .stream_device_destroy = NULL,
-+ .stream_register_device_changed_callback = NULL
++ .stream_register_device_changed_callback = NULL,
++ .register_device_collection_changed = NULL
+};
diff --git media/libcubeb/src/moz.build media/libcubeb/src/moz.build
-index 8b7a0dd..31212ce 100644
+index fc9c79198e30..57d039d5a0f2 100644
--- media/libcubeb/src/moz.build
+++ media/libcubeb/src/moz.build
-@@ -17,6 +17,12 @@ if CONFIG['MOZ_ALSA']:
+@@ -20,6 +20,12 @@ if CONFIG['MOZ_ALSA']:
]
DEFINES['USE_ALSA'] = True
@@ -1090,22 +1155,22 @@ index 8b7a0dd..31212ce 100644
+ ]
+ DEFINES['USE_OSS'] = True
+
- if CONFIG['MOZ_PULSEAUDIO']:
+ if CONFIG['MOZ_PULSEAUDIO'] or CONFIG['MOZ_JACK']:
SOURCES += [
- 'cubeb_pulse.c',
-@@ -75,5 +81,6 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
-
- FAIL_ON_WARNINGS = True
+ 'cubeb_resampler.cpp',
+@@ -92,6 +98,7 @@ if CONFIG['MOZ_WIDGET_TOOLKIT'] == 'gonk':
+ '%' + '%s/system/media/wilhelm/include' % CONFIG['ANDROID_SOURCE'],
+ ]
+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':
+diff --git media/libcubeb/gtest/moz.build media/libcubeb/gtest/moz.build
+index e99968648554..efbbbf779e11 100644
+--- media/libcubeb/gtest/moz.build
++++ media/libcubeb/gtest/moz.build
+@@ -71,7 +71,6 @@ elif CONFIG['OS_TARGET'] == 'OpenBSD':
'sndio',
]
else:
@@ -1114,22 +1179,22 @@ index 1b17c7b..48b56c2 100644
if CONFIG['GNU_CXX']:
diff --git media/libcubeb/update.sh media/libcubeb/update.sh
-index a96badd..2f9585e 100755
+index b139b8f497fd..d1f8a223c6d8 100755
--- media/libcubeb/update.sh
+++ media/libcubeb/update.sh
-@@ -16,6 +16,7 @@ cp $1/src/cubeb_audiounit.cpp src
+@@ -17,6 +17,7 @@ cp $1/src/cubeb_audiounit.cpp src
cp $1/src/cubeb_osx_run_loop.h src
cp $1/src/cubeb_jack.cpp src
cp $1/src/cubeb_opensl.c src
+cp $1/src/cubeb_oss.c src
+ cp $1/src/cubeb_array_queue.h src
cp $1/src/cubeb_panner.cpp src
cp $1/src/cubeb_panner.h src
- cp $1/src/cubeb_pulse.c src
diff --git media/webrtc/signaling/test/common.build media/webrtc/signaling/test/common.build
-index 991f03f..3d99eb5 100644
+index 3e5450f5d63a..dd45427f655a 100644
--- media/webrtc/signaling/test/common.build
+++ media/webrtc/signaling/test/common.build
-@@ -102,8 +102,8 @@ USE_LIBS += ['mozglue']
+@@ -99,8 +99,8 @@ USE_LIBS += ['mozglue']
OS_LIBS += CONFIG['MOZ_WEBRTC_X11_LIBS']
OS_LIBS += CONFIG['REALTIME_LIBS']
@@ -1141,10 +1206,10 @@ index 991f03f..3d99eb5 100644
if CONFIG['MOZ_SYSTEM_JPEG']:
OS_LIBS += CONFIG['MOZ_JPEG_LIBS']
diff --git toolkit/library/moz.build toolkit/library/moz.build
-index e191f13..4fb268a 100644
+index a61c689c83c3..7764df6f8a6b 100644
--- toolkit/library/moz.build
+++ toolkit/library/moz.build
-@@ -234,8 +234,8 @@ if CONFIG['MOZ_SYSTEM_LIBVPX']:
+@@ -242,8 +242,8 @@ if CONFIG['MOZ_SYSTEM_LIBVPX']:
if not CONFIG['MOZ_TREE_PIXMAN']:
OS_LIBS += CONFIG['MOZ_PIXMAN_LIBS']