From 128da4b342b586c92b0fd49f4ea82e7620d58ad5 Mon Sep 17 00:00:00 2001
From: Vincent Lucas <chenzo@jitsi.org>
Date: Wed, 30 Oct 2013 23:40:44 +0100
Subject: [PATCH] Corrects sample rate initialization for Core Audio.

---
 src/org/jitsi/impl/neomedia/device/MacCoreaudioSystem.java | 7 +++----
 .../jmfext/media/renderer/audio/MacCoreaudioRenderer.java  | 6 ++++++
 2 files changed, 9 insertions(+), 4 deletions(-)

diff --git a/src/org/jitsi/impl/neomedia/device/MacCoreaudioSystem.java b/src/org/jitsi/impl/neomedia/device/MacCoreaudioSystem.java
index 1363804c..0a7e6619 100644
--- a/src/org/jitsi/impl/neomedia/device/MacCoreaudioSystem.java
+++ b/src/org/jitsi/impl/neomedia/device/MacCoreaudioSystem.java
@@ -266,13 +266,12 @@ private static double getSupportedSampleRate(
             boolean input,
             String deviceUID)
     {
-        double supportedSampleRate = MacCoreAudioDevice.DEFAULT_SAMPLE_RATE;
-        double defaultSampleRate
+        double supportedSampleRate
             = MacCoreAudioDevice.getNominalSampleRate(deviceUID);
 
-        if (defaultSampleRate >= MediaUtils.MAX_AUDIO_SAMPLE_RATE)
+        if(supportedSampleRate >= MediaUtils.MAX_AUDIO_SAMPLE_RATE)
         {
-            supportedSampleRate = defaultSampleRate;
+            supportedSampleRate = MacCoreAudioDevice.DEFAULT_SAMPLE_RATE;
         }
 
         return supportedSampleRate;
diff --git a/src/org/jitsi/impl/neomedia/jmfext/media/renderer/audio/MacCoreaudioRenderer.java b/src/org/jitsi/impl/neomedia/jmfext/media/renderer/audio/MacCoreaudioRenderer.java
index a526c6d0..8b3aa7ab 100644
--- a/src/org/jitsi/impl/neomedia/jmfext/media/renderer/audio/MacCoreaudioRenderer.java
+++ b/src/org/jitsi/impl/neomedia/jmfext/media/renderer/audio/MacCoreaudioRenderer.java
@@ -319,6 +319,12 @@ public void open()
                         throw new ResourceUnavailableException(
                                 "No locator/MediaLocator is set.");
                     }
+
+                    if (inputFormat == null)
+                    {
+                        throw new ResourceUnavailableException(
+                                "inputFormat not set");
+                    }
                 }
                 finally
                 {
-- 
GitLab