From d79447fab4e1daa2dc5363c188df64866d0be080 Mon Sep 17 00:00:00 2001
From: Boris Grozev <boris@jitsi.org>
Date: Fri, 23 Aug 2013 12:21:54 +0300
Subject: [PATCH] Removes stereo formats from the opus encoder's supported
 input formats, because problems were observed when they were used (and we
 don't yet support stereo decoding anyway).

---
 .../neomedia/codec/audio/opus/JNIEncoder.java | 37 +++++++++++--------
 1 file changed, 22 insertions(+), 15 deletions(-)

diff --git a/src/org/jitsi/impl/neomedia/codec/audio/opus/JNIEncoder.java b/src/org/jitsi/impl/neomedia/codec/audio/opus/JNIEncoder.java
index efff0b88..384a071e 100644
--- a/src/org/jitsi/impl/neomedia/codec/audio/opus/JNIEncoder.java
+++ b/src/org/jitsi/impl/neomedia/codec/audio/opus/JNIEncoder.java
@@ -87,7 +87,8 @@ public class JNIEncoder
 
         int supportedInputCount = SUPPORTED_INPUT_SAMPLE_RATES.length;
 
-        SUPPORTED_INPUT_FORMATS = new Format[supportedInputCount*2];
+        SUPPORTED_INPUT_FORMATS = new Format[supportedInputCount];
+        //SUPPORTED_INPUT_FORMATS = new Format[supportedInputCount*2];
         for (int i = 0; i < supportedInputCount; i++)
         {
             SUPPORTED_INPUT_FORMATS[i]
@@ -102,20 +103,26 @@ public class JNIEncoder
                         /* frameRate */ Format.NOT_SPECIFIED,
                         Format.byteArray);
         }
-        for (int i = 0; i < supportedInputCount; i++)
-        {
-            SUPPORTED_INPUT_FORMATS[i+supportedInputCount]
-                = new AudioFormat(
-                        AudioFormat.LINEAR,
-                        SUPPORTED_INPUT_SAMPLE_RATES[i],
-                        16,
-                        2,
-                        AudioFormat.LITTLE_ENDIAN,
-                        AudioFormat.SIGNED,
-                        /* frameSizeInBits */ Format.NOT_SPECIFIED,
-                        /* frameRate */ Format.NOT_SPECIFIED,
-                        Format.byteArray);
-        }
+        /*
+         * Using stereo input formats leads to problems (at least when used with
+         * pulse audio). It is unclear whether they are rooted in this encoder
+         * or somewhere else in the code. So stereo input formats are disabled
+         * until we make sure that they work properly.
+         */
+        //for (int i = 0; i < supportedInputCount; i++)
+        //{
+        //    SUPPORTED_INPUT_FORMATS[i+supportedInputCount]
+        //        = new AudioFormat(
+        //                AudioFormat.LINEAR,
+        //                SUPPORTED_INPUT_SAMPLE_RATES[i],
+        //                16,
+        //                2,
+        //                AudioFormat.LITTLE_ENDIAN,
+        //                AudioFormat.SIGNED,
+        //                /* frameSizeInBits */ Format.NOT_SPECIFIED,
+        //                /* frameRate */ Format.NOT_SPECIFIED,
+        //                Format.byteArray);
+        //}
     }
 
     /**
-- 
GitLab