Temporarily works around a problem in JAWTRenderer on Mac OS X and MacBookPro8 which appears as low frame rate by falling back to an earlier implementation which seems to work as expected with respect to frame rate.

cusax-fix
Lyubomir Marinov 15 years ago
parent 531846e795
commit 235332bb0f

@ -232,8 +232,6 @@
<compilerarg value="x86_64" if="is.running.macos" />
<compilerarg value="-arch" if="is.running.macos" />
<compilerarg value="i386" if="is.running.macos" />
<compilerarg value="-arch" if="is.running.macos" />
<compilerarg value="ppc" if="is.running.macos" />
<compilerarg value="-I/System/Library/Frameworks/JavaVM.framework/Headers" if="is.running.macos" />
<linkerarg value="-o" location="end" if="is.running.macos" />
@ -242,8 +240,6 @@
<linkerarg value="x86_64" if="is.running.macos" />
<linkerarg value="-arch" if="is.running.macos" />
<linkerarg value="i386" if="is.running.macos" />
<linkerarg value="-arch" if="is.running.macos" />
<linkerarg value="ppc" if="is.running.macos" />
<linkerarg value="-framework" if="is.running.macos" />
<linkerarg value="OpenGL" if="is.running.macos" />
<linkerarg value="-framework" if="is.running.macos" />

@ -35,6 +35,7 @@ void JAWTRenderer_processLightweightComponentEvent
(jlong handle, jint x, jint y, jint width, jint height);
void JAWTRenderer_removeNotifyLightweightComponent
(jlong handle, jobject component);
jstring JAWTRenderer_sysctlbyname(JNIEnv *jniEnv, jstring name);
#endif /* #ifdef __APPLE__ */
#ifdef __cplusplus

@ -11,6 +11,10 @@
#include <stdlib.h>
#include <string.h>
/* sysctlbyname */
#include <sys/types.h>
#include <sys/sysctl.h>
#import <AppKit/NSOpenGL.h>
#import <AppKit/NSView.h>
#import <Foundation/NSArray.h>
@ -322,6 +326,47 @@ JAWTRenderer_removeNotifyLightweightComponent(jlong handle, jobject component)
[autoreleasePool release];
}
jstring
JAWTRenderer_sysctlbyname(JNIEnv *jniEnv, jstring name)
{
const char *_name;
jstring value = NULL;
_name = (*jniEnv)->GetStringUTFChars(jniEnv, name, NULL);
if (_name)
{
size_t valueLength;
char *_value;
if ((0 == sysctlbyname(_name, NULL, &valueLength, NULL, 0))
&& valueLength)
{
_value = malloc(sizeof(char) * (valueLength + 1));
if (_value)
{
if ((0 == sysctlbyname(_name, _value, &valueLength, NULL, 0))
&& valueLength)
_value[valueLength] = 0;
else
{
free(_value);
_value = NULL;
}
}
}
else
_value = NULL;
(*jniEnv)->ReleaseStringUTFChars(jniEnv, name, _name);
if (_value)
{
value = (*jniEnv)->NewStringUTF(jniEnv, _value);
free(_value);
}
}
return value;
}
@implementation JAWTRenderer
- (void)addSubrenderer:(JAWTRenderer *)subrenderer
{

@ -142,3 +142,12 @@ Java_net_java_sip_communicator_impl_neomedia_jmfext_media_renderer_video_JAWTRen
JAWTRenderer_removeNotifyLightweightComponent(handle, component);
#endif /* #ifdef __APPLE__ */
}
JNIEXPORT jstring JNICALL
Java_net_java_sip_communicator_impl_neomedia_jmfext_media_renderer_video_JAWTRenderer_sysctlbyname
(JNIEnv *jniEnv, jclass clazz, jstring name)
{
#ifdef __APPLE__
return JAWTRenderer_sysctlbyname(jniEnv, name);
#endif /* #ifdef __APPLE__ */
}

@ -10,7 +10,7 @@ extern "C" {
/*
* Class: net_java_sip_communicator_impl_neomedia_jmfext_media_renderer_video_JAWTRenderer
* Method: addNotifyLightweightComponent
* Signature: (JLjavax/swing/JComponent;J)V
* Signature: (JLjava/awt/Component;J)V
*/
JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_jmfext_media_renderer_video_JAWTRenderer_addNotifyLightweightComponent
(JNIEnv *, jclass, jlong, jobject, jlong);
@ -66,11 +66,19 @@ JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_jmfext_media
/*
* Class: net_java_sip_communicator_impl_neomedia_jmfext_media_renderer_video_JAWTRenderer
* Method: removeNotifyLightweightComponent
* Signature: (JLjavax/swing/JComponent;)V
* Signature: (JLjava/awt/Component;)V
*/
JNIEXPORT void JNICALL Java_net_java_sip_communicator_impl_neomedia_jmfext_media_renderer_video_JAWTRenderer_removeNotifyLightweightComponent
(JNIEnv *, jclass, jlong, jobject);
/*
* Class: net_java_sip_communicator_impl_neomedia_jmfext_media_renderer_video_JAWTRenderer
* Method: sysctlbyname
* Signature: (Ljava/lang/String;)Ljava/lang/String;
*/
JNIEXPORT jstring JNICALL Java_net_java_sip_communicator_impl_neomedia_jmfext_media_renderer_video_JAWTRenderer_sysctlbyname
(JNIEnv *, jclass, jstring);
#ifdef __cplusplus
}
#endif

@ -73,11 +73,34 @@ public class JAWTRenderer
* The indicator which determines whether <tt>CALayer</tt>-based painting is
* to be performed by <tt>JAWTRenderer</tt> on Mac OS X.
*/
private static final boolean USE_MACOSX_CALAYERS = true;
private static final boolean USE_MACOSX_CALAYERS;
static
{
System.loadLibrary("jawtrenderer");
/*
* XXX The native JAWTRenderer implementation on Mac OS X which paints
* in a CALayer-like fashion has been determined through testing to not
* work as expected on MacBookPro8. Unfortunately, the cause of the
* problem has not been determined. As a workaround, fall back to the
* alternative implementation (currently used on the other supported
* operating systems) on the problematic model.
*/
if (OSUtils.IS_MAC)
{
String hwModel = sysctlbyname("hw.model");
if ((hwModel != null) && hwModel.startsWith("MacBookPro8"))
USE_MACOSX_CALAYERS = false;
else
USE_MACOSX_CALAYERS = true;
}
else
{
// CALayer-like painting is currently only supported on Mac OS X.
USE_MACOSX_CALAYERS = false;
}
}
/**
@ -577,6 +600,8 @@ public void stop()
{
}
private static native String sysctlbyname(String name);
/**
* Implements an AWT <tt>Component</tt> in which this <tt>JAWTRenderer</tt>
* paints.

Loading…
Cancel
Save