aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--tools/android/packaging/xbmc/src/org/xbmc/xbmc/Main.java8
-rw-r--r--tools/android/packaging/xbmc/src/org/xbmc/xbmc/XBMCBroadcastReceiver.java6
-rw-r--r--xbmc/cores/dvdplayer/DVDCodecs/Video/libstagefrightICS/StageFrightVideoPrivate.cpp71
3 files changed, 35 insertions, 50 deletions
diff --git a/tools/android/packaging/xbmc/src/org/xbmc/xbmc/Main.java b/tools/android/packaging/xbmc/src/org/xbmc/xbmc/Main.java
index a94f9254ad..35ad6084ed 100644
--- a/tools/android/packaging/xbmc/src/org/xbmc/xbmc/Main.java
+++ b/tools/android/packaging/xbmc/src/org/xbmc/xbmc/Main.java
@@ -3,10 +3,12 @@ package org.xbmc.xbmc;
import android.app.NativeActivity;
import android.content.Intent;
import android.os.Bundle;
+import android.util.Log;
public class Main extends NativeActivity
{
native void _onNewIntent(Intent intent);
+
public Main()
{
super();
@@ -22,7 +24,11 @@ public class Main extends NativeActivity
protected void onNewIntent(Intent intent)
{
super.onNewIntent(intent);
- _onNewIntent(intent);
+ try {
+ _onNewIntent(intent);
+ } catch (UnsatisfiedLinkError e) {
+ Log.e("Main", "Native not registered");
+ }
}
}
diff --git a/tools/android/packaging/xbmc/src/org/xbmc/xbmc/XBMCBroadcastReceiver.java b/tools/android/packaging/xbmc/src/org/xbmc/xbmc/XBMCBroadcastReceiver.java
index a3c7886de4..93e37a43de 100644
--- a/tools/android/packaging/xbmc/src/org/xbmc/xbmc/XBMCBroadcastReceiver.java
+++ b/tools/android/packaging/xbmc/src/org/xbmc/xbmc/XBMCBroadcastReceiver.java
@@ -13,6 +13,10 @@ public class XBMCBroadcastReceiver extends BroadcastReceiver
public void onReceive(Context context, Intent intent)
{
Log.d("XBMCBroadcastReceiver", "Received Intent");
- _onReceive(intent);
+ try {
+ _onReceive(intent);
+ } catch (UnsatisfiedLinkError e) {
+ Log.e("XBMCBroadcastReceiver", "Native not registered");
+ }
}
}
diff --git a/xbmc/cores/dvdplayer/DVDCodecs/Video/libstagefrightICS/StageFrightVideoPrivate.cpp b/xbmc/cores/dvdplayer/DVDCodecs/Video/libstagefrightICS/StageFrightVideoPrivate.cpp
index 0390233df7..5031df8536 100644
--- a/xbmc/cores/dvdplayer/DVDCodecs/Video/libstagefrightICS/StageFrightVideoPrivate.cpp
+++ b/xbmc/cores/dvdplayer/DVDCodecs/Video/libstagefrightICS/StageFrightVideoPrivate.cpp
@@ -352,54 +352,31 @@ bool CStageFrightVideoPrivate::InitSurfaceTexture()
if (mVideoNativeWindow != NULL)
return false;
- mVideoTextureId = -1;
-
- // We MUST create the GLES texture on the main thread
- // to match where the valid GLES context is located.
- // It would be nice to move this out of here, we would need
- // to create/fetch/create from g_RenderMananger. But g_RenderMananger
- // does not know we are using MediaCodec until Configure and we
- // we need m_surfaceTexture valid before then. Chicken, meet Egg.
- if (m_g_application->IsCurrentThread())
- {
- // localize GLuint so we do not spew gles includes in our header
- GLuint texture_id;
-
- glGenTextures(1, &texture_id);
- glBindTexture( GL_TEXTURE_EXTERNAL_OES, texture_id);
- glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
- glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
- glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
- glBindTexture( GL_TEXTURE_EXTERNAL_OES, 0);
- mVideoTextureId = texture_id;
- }
- else
- {
- ThreadMessageCallback callbackData;
- callbackData.callback = &CallbackInitSurfaceTexture;
- callbackData.userptr = (void*)this;
-
- ThreadMessage msg;
- msg.dwMessage = TMSG_CALLBACK;
- msg.lpVoid = (void*)&callbackData;
-
- // wait for it.
- m_g_applicationMessenger->SendMessage(msg, true);
-
- mSurfTexture = new CJNISurfaceTexture(mVideoTextureId);
- mSurface = new CJNISurface(*mSurfTexture);
+ //FIXME: Playing back-to-back vids induces a bug when properly generating textures between runs.
+ // Symptoms are upside down vid, "updateTexImage: error binding external texture" in log, and crash
+ // after stopping.
+ // Workaround is to always use the same, arbitrary chosen, texture ids.
+ mVideoTextureId = 0xbaad;
+
+ glBindTexture( GL_TEXTURE_EXTERNAL_OES, mVideoTextureId);
+ glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
+ glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
+ glTexParameterf(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
+ glBindTexture( GL_TEXTURE_EXTERNAL_OES, 0);
+
+ mSurfTexture = new CJNISurfaceTexture(mVideoTextureId);
+ mSurface = new CJNISurface(*mSurfTexture);
+
+ JNIEnv* env = xbmc_jnienv();
+ mVideoNativeWindow = ANativeWindow_fromSurface(env, mSurface->get_raw());
+ native_window_api_connect(mVideoNativeWindow.get(), NATIVE_WINDOW_API_MEDIA);
- JNIEnv* env = xbmc_jnienv();
- mVideoNativeWindow = ANativeWindow_fromSurface(env, mSurface->get_raw());
- native_window_api_connect(mVideoNativeWindow.get(), NATIVE_WINDOW_API_MEDIA);
-
- #if defined(DEBUG_VERBOSE)
- CLog::Log(LOGDEBUG, "%s: <<< InitSurfaceTexture texid(%d) natwin(%p)\n", CLASSNAME, mVideoTextureId, mVideoNativeWindow.get());
- #endif
- }
+#if defined(DEBUG_VERBOSE)
+ CLog::Log(LOGDEBUG, "%s: <<< InitSurfaceTexture texid(%d) natwin(%p)\n", CLASSNAME, mVideoTextureId, mVideoNativeWindow.get());
+#endif
- return (mVideoTextureId != -1);
+ return true;
}
void CStageFrightVideoPrivate::ReleaseSurfaceTexture()
@@ -420,8 +397,6 @@ void CStageFrightVideoPrivate::ReleaseSurfaceTexture()
delete mSurface;
delete mSurfTexture;
- if (mVideoTextureId > 0)
- glDeleteTextures(1, &mVideoTextureId);
#if defined(DEBUG_VERBOSE)
CLog::Log(LOGDEBUG, "%s: <<< ReleaseSurfaceTexture\n", CLASSNAME);
#endif