Skip to content
Snippets Groups Projects
Commit fb11459d authored by Lyubomir Marinov's avatar Lyubomir Marinov
Browse files

Fixes an access violation during the initialization of the PortAudio...

Fixes an access violation during the initialization of the PortAudio integration. Reported by Tudor Berechet.
parent c37e16b0
No related branches found
No related tags found
No related merge requests found
...@@ -64,9 +64,12 @@ else if (OSUtils.IS_WINDOWS_VISTA ...@@ -64,9 +64,12 @@ else if (OSUtils.IS_WINDOWS_VISTA
public static native void freeDevices(); public static native void freeDevices();
public static String getDeviceModelIdentifier( public static String getDeviceModelIdentifier(String deviceUID)
String deviceUID)
{ {
// Prevent an access violation in getDeviceModelIdentifierBytes.
if (deviceUID == null)
throw new NullPointerException("deviceUID");
byte[] deviceModelIdentifierBytes byte[] deviceModelIdentifierBytes
= getDeviceModelIdentifierBytes(deviceUID); = getDeviceModelIdentifierBytes(deviceUID);
String deviceModelIdentifier String deviceModelIdentifier
......
...@@ -548,12 +548,22 @@ protected void doInitialize() ...@@ -548,12 +548,22 @@ protected void doInitialize()
= Pa.DeviceInfo_getTransportType(deviceInfo); = Pa.DeviceInfo_getTransportType(deviceInfo);
String deviceUID String deviceUID
= Pa.DeviceInfo_getDeviceUID(deviceInfo); = Pa.DeviceInfo_getDeviceUID(deviceInfo);
String modelIdentifier = null; String modelIdentifier;
if(CoreAudioDevice.isLoaded) String locatorRemainder;
if (deviceUID == null)
{
modelIdentifier = null;
locatorRemainder = name;
}
else
{
modelIdentifier modelIdentifier
= CoreAudioDevice.getDeviceModelIdentifier(deviceUID); = CoreAudioDevice.isLoaded
String deviceLocatorID ? CoreAudioDevice.getDeviceModelIdentifier(deviceUID)
= (deviceUID != null)? deviceUID: name; : null;
locatorRemainder = deviceUID;
}
/* /*
* TODO The intention of reinitialize() was to perform the * TODO The intention of reinitialize() was to perform the
...@@ -589,7 +599,7 @@ protected void doInitialize() ...@@ -589,7 +599,7 @@ protected void doInitialize()
= new CaptureDeviceInfo2( = new CaptureDeviceInfo2(
name, name,
new MediaLocator( new MediaLocator(
LOCATOR_PROTOCOL + ":#" + deviceLocatorID), LOCATOR_PROTOCOL + ":#" + locatorRemainder),
new Format[] new Format[]
{ {
new AudioFormat( new AudioFormat(
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment