From 423f51e713b220e1b3e4c08f31bf314d50e0e6bb Mon Sep 17 00:00:00 2001
From: Vincent Lucas <chenzo@jitsi.org>
Date: Fri, 21 Dec 2012 10:13:42 +0000
Subject: [PATCH] Activates the use of model identifier for audio device.

---
 src/org/jitsi/impl/neomedia/device/Devices.java      | 12 ++++++------
 .../neomedia/device/ExtendedCaptureDeviceInfo.java   |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/src/org/jitsi/impl/neomedia/device/Devices.java b/src/org/jitsi/impl/neomedia/device/Devices.java
index c7e9ca32..3e6794f2 100644
--- a/src/org/jitsi/impl/neomedia/device/Devices.java
+++ b/src/org/jitsi/impl/neomedia/device/Devices.java
@@ -73,7 +73,7 @@ public ExtendedCaptureDeviceInfo getDevice(
                 ExtendedCaptureDeviceInfo activeDevice = activeDevices.get(i);
 
                 if(!devicePreferences.contains(
-                            activeDevice.getIdentifier()))
+                            activeDevice.getModelIdentifier()))
                 {
                     // Adds the device in the preference list (to the end of the
                     // list, but the save device will push it to the top of
@@ -98,7 +98,7 @@ public ExtendedCaptureDeviceInfo getDevice(
                         // If we have found the "preferred" device among active
                         // device.
                         if(devicePreference.equals(
-                                activeDevice.getIdentifier()))
+                                activeDevice.getModelIdentifier()))
                         {
                             return activeDevice;
                         }
@@ -210,7 +210,7 @@ private void saveDevice(
         String selectedDeviceIdentifier
             = (device == null)
                 ? NoneAudioSystem.LOCATOR_PROTOCOL
-                : device.getIdentifier();
+                : device.getModelIdentifier();
 
         // Sorts the user preferences to put the selected device on top.
         addToDevicePreferences(
@@ -306,7 +306,7 @@ private void addToDevicePreferences(
                     for(ExtendedCaptureDeviceInfo activeDevice : activeDevices)
                     {
                         if(devicePreference.equals(
-                                    activeDevice.getIdentifier())
+                                    activeDevice.getModelIdentifier())
                                 || devicePreference.equals(
                                         NoneAudioSystem.LOCATOR_PROTOCOL))
                         {
@@ -337,12 +337,12 @@ private void renameOldFashionedIdentifier(
         for(ExtendedCaptureDeviceInfo activeDevice : activeDevices)
         {
             String name = activeDevice.getName();
-            String id = activeDevice.getIdentifier();
+            String id = activeDevice.getModelIdentifier();
 
             // We can only switch to the new fashioned notation, only if the OS
             // API gives us a unique identifier (different from the device
             // name).
-            if(id != null)
+            if(!name.equals(id))
             {
                 synchronized(devicePreferences)
                 {
diff --git a/src/org/jitsi/impl/neomedia/device/ExtendedCaptureDeviceInfo.java b/src/org/jitsi/impl/neomedia/device/ExtendedCaptureDeviceInfo.java
index f166a83d..dfc3cfe0 100644
--- a/src/org/jitsi/impl/neomedia/device/ExtendedCaptureDeviceInfo.java
+++ b/src/org/jitsi/impl/neomedia/device/ExtendedCaptureDeviceInfo.java
@@ -142,7 +142,7 @@ public String getUID()
      */
     public String getModelIdentifier()
     {
-        return modelIdentifier;
+        return (modelIdentifier == null) ? name : modelIdentifier;
     }
 
     /**
-- 
GitLab