Skip to content
Snippets Groups Projects
Commit f7ad462c authored by Vincent Lucas's avatar Vincent Lucas
Browse files

Corrects deadlock when closing renderer in Core Audio. Reports c error to java logger.

parent 5666d70c
No related branches found
No related tags found
No related merge requests found
No preview for this file type
......@@ -248,3 +248,52 @@ void maccoreaudio_freeHotplug(
maccoreaudio_devicesChangedCallbackClass = NULL;
maccoreaudio_devicesChangedCallbackMethodID = NULL;
}
/**
* Logs the corresponding error message.
*
* @param error_format The format of the error message.
* @param ... The list of variable specified in the format argument.
*/
void maccoreaudio_log(
const char * error_format,
...)
{
JNIEnv *env = NULL;
if((*maccoreaudio_VM)->AttachCurrentThreadAsDaemon(
maccoreaudio_VM,
(void**) &env,
NULL)
== 0)
{
jclass clazz = (*env)->FindClass(
env,
"org/jitsi/impl/neomedia/CoreAudioDevice");
if (clazz)
{
jmethodID methodID
= (*env)->GetStaticMethodID(env, clazz, "log", "([B)V");
int error_length = 2048;
char error[error_length];
va_list arg;
va_start (arg, error_format);
vsnprintf(error, error_length, error_format, arg);
va_end (arg);
int str_len = strlen(error);
jbyteArray bufferBytes = (*env)->NewByteArray(env, str_len);
(*env)->SetByteArrayRegion(
env,
bufferBytes,
0,
str_len,
(jbyte *) error);
(*env)->CallStaticVoidMethod(env, clazz, methodID, bufferBytes);
}
(*maccoreaudio_VM)->DetachCurrentThread(maccoreaudio_VM);
}
}
......@@ -39,4 +39,8 @@ void maccoreaudio_callbackMethod(
void maccoreaudio_devicesChangedCallbackMethod(
void);
void maccoreaudio_log(
const char * error_format,
...);
#endif
This diff is collapsed.
......@@ -15,6 +15,13 @@
*/
public class CoreAudioDevice
{
/**
* The <tt>Logger</tt> used by the <tt>CoreAudioDevice</tt> class and
* its instances for logging output.
*/
private static final Logger logger
= Logger.getLogger(CoreAudioDevice.class);
/**
* Tells if the CoreAudio library used by this CoreAudioDevice is correctly
* loaded: if we are under a supported operating system.
......@@ -132,4 +139,10 @@ public static void setDevicesChangedCallback(
{
CoreAudioDevice.devicesChangedCallback = devicesChangedCallback;
}
public static void log(byte[] error)
{
String errorString = StringUtils.newString(error);
logger.info(errorString);
}
}
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