Bug 1270004 - Update libcubeb. rs=jesup
authorMatthew Gregan <kinetik@flim.org>
Fri, 06 May 2016 10:36:41 +1200
changeset 296335 cc9051869d1a9078a821da5d1639299f9e836e0e
parent 296334 60e1edb012c0e558fdd4092dc28f24685f727399
child 296336 1ee604ae873ffae665e745b3553fb1c406dbdd6a
push id30236
push usercbook@mozilla.com
push dateFri, 06 May 2016 12:19:04 +0000
treeherdermozilla-central@19a1743ceb2e [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersjesup
bugs1270004
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1270004 - Update libcubeb. rs=jesup
media/libcubeb/README_MOZILLA
media/libcubeb/src/cubeb_alsa.c
media/libcubeb/src/cubeb_audiounit.c
media/libcubeb/src/cubeb_winmm.c
--- a/media/libcubeb/README_MOZILLA
+++ b/media/libcubeb/README_MOZILLA
@@ -1,8 +1,8 @@
 The source from this directory was copied from the cubeb 
 git repository using the update.sh script.  The only changes
 made were those applied by update.sh and the addition of
 Makefile.in build files for the Mozilla build system.
 
 The cubeb git repository is: git://github.com/kinetiknz/cubeb.git
 
-The git commit ID used was b576c355498b44a277f00b6a7d006549b3519013.
+The git commit ID used was 2b3d6dc8c4353c38d3e9e2bdc9a688d6d632ac19.
--- a/media/libcubeb/src/cubeb_alsa.c
+++ b/media/libcubeb/src/cubeb_alsa.c
@@ -791,17 +791,21 @@ alsa_stream_init(cubeb * ctx, cubeb_stre
 {
   cubeb_stream * stm;
   int r;
   snd_pcm_format_t format;
   snd_pcm_uframes_t period_size;
 
   assert(ctx && stream);
 
-  assert(!input_stream_params && "not supported.");
+  if (input_stream_params) {
+    /* Capture support not yet implemented. */
+    return CUBEB_ERROR_NOT_SUPPORTED;
+  }
+
   if (input_device || output_device) {
     /* Device selection not yet implemented. */
     return CUBEB_ERROR_DEVICE_UNAVAILABLE;
   }
 
   *stream = NULL;
 
   switch (output_stream_params->format) {
--- a/media/libcubeb/src/cubeb_audiounit.c
+++ b/media/libcubeb/src/cubeb_audiounit.c
@@ -146,16 +146,22 @@ audiotimestamp_to_latency(AudioTimeStamp
   }
 
   uint64_t pres = AudioConvertHostTimeToNanos(tstamp->mHostTime);
   uint64_t now = AudioConvertHostTimeToNanos(AudioGetCurrentHostTime());
 
   return ((pres - now) * stream->output_desc.mSampleRate) / 1000000000LL;
 }
 
+static void
+audiounit_make_silent(AudioBuffer * ioData)
+{
+  memset(ioData->mData, 0, ioData->mDataByteSize);
+}
+
 static OSStatus
 audiounit_input_callback(void * user_ptr,
                          AudioUnitRenderActionFlags * flags,
                          AudioTimeStamp const * tstamp,
                          UInt32 bus,
                          UInt32 input_frames,
                          AudioBufferList * bufs)
 {
@@ -188,17 +194,22 @@ audiounit_input_callback(void * user_ptr
 
   /* Render input samples */
   OSStatus r = AudioUnitRender(stm->input_unit,
                                flags,
                                tstamp,
                                bus,
                                input_frames,
                                &input_buffer_list);
-  assert(r == noErr);
+  if (r != noErr) {
+    LOG("Input AudioUnitRender failed with error=%d", r);
+    audiounit_make_silent(input_buffer);
+    return r;
+  }
+
   LOG("- input:  buffers %d, size %d, channels %d, frames %d\n",
       input_buffer_list.mNumberBuffers,
       input_buffer_list.mBuffers[0].mDataByteSize,
       input_buffer_list.mBuffers[0].mNumberChannels,
       input_frames);
 
   assert(input_frames > 0);
   stm->frames_read += input_frames;
@@ -226,22 +237,16 @@ audiounit_input_callback(void * user_ptr
     pthread_mutex_unlock(&stm->mutex);
     return noErr;
   }
 
   pthread_mutex_unlock(&stm->mutex);
   return noErr;
 }
 
-static void
-audiounit_make_silent(AudioBuffer * ioData)
-{
-  memset(ioData->mData, 0, ioData->mDataByteSize);
-}
-
 static OSStatus
 audiounit_output_callback(void * user_ptr,
                           AudioUnitRenderActionFlags * flags,
                           AudioTimeStamp const * tstamp,
                           UInt32 bus,
                           UInt32 output_frames,
                           AudioBufferList * outBufferList)
 {
--- a/media/libcubeb/src/cubeb_winmm.c
+++ b/media/libcubeb/src/cubeb_winmm.c
@@ -393,17 +393,21 @@ winmm_stream_init(cubeb * context, cubeb
   WAVEFORMATEXTENSIBLE wfx;
   cubeb_stream * stm;
   int i;
   size_t bufsz;
 
   XASSERT(context);
   XASSERT(stream);
 
-  XASSERT(!input_stream_params && "not supported.");
+  if (input_stream_params) {
+    /* Capture support not yet implemented. */
+    return CUBEB_ERROR_NOT_SUPPORTED;
+  }
+
   if (input_device || output_device) {
     /* Device selection not yet implemented. */
     return CUBEB_ERROR_DEVICE_UNAVAILABLE;
   }
 
   *stream = NULL;
 
   memset(&wfx, 0, sizeof(wfx));