mirror of
https://github.com/moonlight-stream/moonlight-android.git
synced 2026-04-04 06:56:06 +00:00
Move GLRenderer fetching into PcView to avoid race conditions inside Game activity and cache the result
This commit is contained in:
@@ -20,6 +20,7 @@ import com.limelight.nvstream.http.NvApp;
|
||||
import com.limelight.nvstream.input.KeyboardPacket;
|
||||
import com.limelight.nvstream.input.MouseButtonPacket;
|
||||
import com.limelight.nvstream.jni.MoonBridge;
|
||||
import com.limelight.preferences.GlPreferences;
|
||||
import com.limelight.preferences.PreferenceConfiguration;
|
||||
import com.limelight.ui.GameGestures;
|
||||
import com.limelight.ui.StreamView;
|
||||
@@ -44,7 +45,6 @@ import android.hardware.input.InputManager;
|
||||
import android.media.AudioManager;
|
||||
import android.net.ConnectivityManager;
|
||||
import android.net.wifi.WifiManager;
|
||||
import android.opengl.GLSurfaceView;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
@@ -66,9 +66,6 @@ import android.widget.FrameLayout;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Toast;
|
||||
|
||||
import javax.microedition.khronos.egl.EGLConfig;
|
||||
import javax.microedition.khronos.opengles.GL10;
|
||||
|
||||
|
||||
public class Game extends Activity implements SurfaceHolder.Callback,
|
||||
OnGenericMotionListener, OnTouchListener, NvConnectionListener, EvdevListener,
|
||||
@@ -108,7 +105,6 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
||||
private ShortcutHelper shortcutHelper;
|
||||
|
||||
private MediaCodecDecoderRenderer decoderRenderer;
|
||||
private String glRenderer;
|
||||
|
||||
private WifiManager.WifiLock wifiLock;
|
||||
|
||||
@@ -167,33 +163,6 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
||||
// Change volume button behavior
|
||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||
|
||||
// We first construct a GLSurfaceView to probe for GL
|
||||
// properties to pass to MediaCodecHelper. After this completes,
|
||||
// we'll construct the activity like normal.
|
||||
GLSurfaceView surfaceView = new GLSurfaceView(this);
|
||||
surfaceView.setRenderer(new GLSurfaceView.Renderer() {
|
||||
@Override
|
||||
public void onSurfaceCreated(GL10 gl10, EGLConfig eglConfig) {
|
||||
glRenderer = gl10.glGetString(GL10.GL_RENDERER);
|
||||
LimeLog.info("GL Renderer: "+glRenderer);
|
||||
runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
completeOnCreate();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSurfaceChanged(GL10 gl10, int i, int i1) {}
|
||||
|
||||
@Override
|
||||
public void onDrawFrame(GL10 gl10) {}
|
||||
});
|
||||
setContentView(surfaceView);
|
||||
}
|
||||
|
||||
private void completeOnCreate() {
|
||||
// Inflate the content
|
||||
setContentView(R.layout.activity_game);
|
||||
|
||||
@@ -257,7 +226,7 @@ public class Game extends Activity implements SurfaceHolder.Callback,
|
||||
shortcutHelper.reportShortcutUsed(uuid);
|
||||
|
||||
// Initialize the MediaCodec helper before creating the decoder
|
||||
MediaCodecHelper.initialize(this, glRenderer);
|
||||
MediaCodecHelper.initialize(this, GlPreferences.readPreferences(this).glRenderer);
|
||||
|
||||
// Check if the user has enabled HDR
|
||||
if (prefConfig.enableHdr) {
|
||||
|
||||
Reference in New Issue
Block a user