com.google.android.exoplayer2.util.EGLSurfaceTexture.SecureMode Java Examples

The following examples show how to use com.google.android.exoplayer2.util.EGLSurfaceTexture.SecureMode. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: DummySurface.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
@TargetApi(24)
private static @SecureMode int getSecureModeV24(Context context) {
  if (Util.SDK_INT < 26 && ("samsung".equals(Util.MANUFACTURER) || "XT1650".equals(Util.MODEL))) {
    // Samsung devices running Nougat are known to be broken. See
    // https://github.com/google/ExoPlayer/issues/3373 and [Internal: b/37197802].
    // Moto Z XT1650 is also affected. See
    // https://github.com/google/ExoPlayer/issues/3215.
    return SECURE_MODE_NONE;
  }
  if (Util.SDK_INT < 26 && !context.getPackageManager().hasSystemFeature(
      PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE)) {
    // Pre API level 26 devices were not well tested unless they supported VR mode.
    return SECURE_MODE_NONE;
  }
  EGLDisplay display = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
  String eglExtensions = EGL14.eglQueryString(display, EGL10.EGL_EXTENSIONS);
  if (eglExtensions == null) {
    return SECURE_MODE_NONE;
  }
  if (!eglExtensions.contains(EXTENSION_PROTECTED_CONTENT)) {
    return SECURE_MODE_NONE;
  }
  // If we can't use surfaceless contexts, we use a protected 1 * 1 pixel buffer surface. This may
  // require support for EXT_protected_surface, but in practice it works on some devices that
  // don't have that extension. See also https://github.com/google/ExoPlayer/issues/3558.
  return eglExtensions.contains(EXTENSION_SURFACELESS_CONTEXT)
      ? SECURE_MODE_SURFACELESS_CONTEXT
      : SECURE_MODE_PROTECTED_PBUFFER;
}
 
Example #2
Source File: DummySurface.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
public DummySurface init(@SecureMode int secureMode) {
  start();
  handler = new Handler(getLooper(), /* callback= */ this);
  eglSurfaceTexture = new EGLSurfaceTexture(handler);
  boolean wasInterrupted = false;
  synchronized (this) {
    handler.obtainMessage(MSG_INIT, secureMode, 0).sendToTarget();
    while (surface == null && initException == null && initError == null) {
      try {
        wait();
      } catch (InterruptedException e) {
        wasInterrupted = true;
      }
    }
  }
  if (wasInterrupted) {
    // Restore the interrupted status.
    Thread.currentThread().interrupt();
  }
  if (initException != null) {
    throw initException;
  } else if (initError != null) {
    throw initError;
  } else {
    return Assertions.checkNotNull(surface);
  }
}
 
Example #3
Source File: DummySurface.java    From MediaSDK with Apache License 2.0 5 votes vote down vote up
private void initInternal(@SecureMode int secureMode) {
  Assertions.checkNotNull(eglSurfaceTexture);
  eglSurfaceTexture.init(secureMode);
  this.surface =
      new DummySurface(
          this, eglSurfaceTexture.getSurfaceTexture(), secureMode != SECURE_MODE_NONE);
}
 
Example #4
Source File: DummySurface.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@TargetApi(24)
private static @SecureMode int getSecureModeV24(Context context) {
  if (Util.SDK_INT < 26 && ("samsung".equals(Util.MANUFACTURER) || "XT1650".equals(Util.MODEL))) {
    // Samsung devices running Nougat are known to be broken. See
    // https://github.com/google/ExoPlayer/issues/3373 and [Internal: b/37197802].
    // Moto Z XT1650 is also affected. See
    // https://github.com/google/ExoPlayer/issues/3215.
    return SECURE_MODE_NONE;
  }
  if (Util.SDK_INT < 26 && !context.getPackageManager().hasSystemFeature(
      PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE)) {
    // Pre API level 26 devices were not well tested unless they supported VR mode.
    return SECURE_MODE_NONE;
  }
  EGLDisplay display = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
  String eglExtensions = EGL14.eglQueryString(display, EGL10.EGL_EXTENSIONS);
  if (eglExtensions == null) {
    return SECURE_MODE_NONE;
  }
  if (!eglExtensions.contains(EXTENSION_PROTECTED_CONTENT)) {
    return SECURE_MODE_NONE;
  }
  // If we can't use surfaceless contexts, we use a protected 1 * 1 pixel buffer surface. This may
  // require support for EXT_protected_surface, but in practice it works on some devices that
  // don't have that extension. See also https://github.com/google/ExoPlayer/issues/3558.
  return eglExtensions.contains(EXTENSION_SURFACELESS_CONTEXT)
      ? SECURE_MODE_SURFACELESS_CONTEXT
      : SECURE_MODE_PROTECTED_PBUFFER;
}
 
Example #5
Source File: DummySurface.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public DummySurface init(@SecureMode int secureMode) {
  start();
  handler = new Handler(getLooper(), /* callback= */ this);
  eglSurfaceTexture = new EGLSurfaceTexture(handler);
  boolean wasInterrupted = false;
  synchronized (this) {
    handler.obtainMessage(MSG_INIT, secureMode, 0).sendToTarget();
    while (surface == null && initException == null && initError == null) {
      try {
        wait();
      } catch (InterruptedException e) {
        wasInterrupted = true;
      }
    }
  }
  if (wasInterrupted) {
    // Restore the interrupted status.
    Thread.currentThread().interrupt();
  }
  if (initException != null) {
    throw initException;
  } else if (initError != null) {
    throw initError;
  } else {
    return Assertions.checkNotNull(surface);
  }
}
 
Example #6
Source File: DummySurface.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void initInternal(@SecureMode int secureMode) {
  Assertions.checkNotNull(eglSurfaceTexture);
  eglSurfaceTexture.init(secureMode);
  this.surface =
      new DummySurface(
          this, eglSurfaceTexture.getSurfaceTexture(), secureMode != SECURE_MODE_NONE);
}
 
Example #7
Source File: DummySurface.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@TargetApi(24)
private static @SecureMode int getSecureModeV24(Context context) {
  if (Util.SDK_INT < 26 && ("samsung".equals(Util.MANUFACTURER) || "XT1650".equals(Util.MODEL))) {
    // Samsung devices running Nougat are known to be broken. See
    // https://github.com/google/ExoPlayer/issues/3373 and [Internal: b/37197802].
    // Moto Z XT1650 is also affected. See
    // https://github.com/google/ExoPlayer/issues/3215.
    return SECURE_MODE_NONE;
  }
  if (Util.SDK_INT < 26 && !context.getPackageManager().hasSystemFeature(
      PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE)) {
    // Pre API level 26 devices were not well tested unless they supported VR mode.
    return SECURE_MODE_NONE;
  }
  EGLDisplay display = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
  String eglExtensions = EGL14.eglQueryString(display, EGL10.EGL_EXTENSIONS);
  if (eglExtensions == null) {
    return SECURE_MODE_NONE;
  }
  if (!eglExtensions.contains(EXTENSION_PROTECTED_CONTENT)) {
    return SECURE_MODE_NONE;
  }
  // If we can't use surfaceless contexts, we use a protected 1 * 1 pixel buffer surface. This may
  // require support for EXT_protected_surface, but in practice it works on some devices that
  // don't have that extension. See also https://github.com/google/ExoPlayer/issues/3558.
  return eglExtensions.contains(EXTENSION_SURFACELESS_CONTEXT)
      ? SECURE_MODE_SURFACELESS_CONTEXT
      : SECURE_MODE_PROTECTED_PBUFFER;
}
 
Example #8
Source File: DummySurface.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
public DummySurface init(@SecureMode int secureMode) {
  start();
  handler = new Handler(getLooper(), /* callback= */ this);
  eglSurfaceTexture = new EGLSurfaceTexture(handler);
  boolean wasInterrupted = false;
  synchronized (this) {
    handler.obtainMessage(MSG_INIT, secureMode, 0).sendToTarget();
    while (surface == null && initException == null && initError == null) {
      try {
        wait();
      } catch (InterruptedException e) {
        wasInterrupted = true;
      }
    }
  }
  if (wasInterrupted) {
    // Restore the interrupted status.
    Thread.currentThread().interrupt();
  }
  if (initException != null) {
    throw initException;
  } else if (initError != null) {
    throw initError;
  } else {
    return Assertions.checkNotNull(surface);
  }
}
 
Example #9
Source File: DummySurface.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
private void initInternal(@SecureMode int secureMode) {
  Assertions.checkNotNull(eglSurfaceTexture);
  eglSurfaceTexture.init(secureMode);
  this.surface =
      new DummySurface(
          this, eglSurfaceTexture.getSurfaceTexture(), secureMode != SECURE_MODE_NONE);
}
 
Example #10
Source File: DummySurface.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@TargetApi(24)
private static @SecureMode int getSecureModeV24(Context context) {
  if (Util.SDK_INT < 26 && ("samsung".equals(Util.MANUFACTURER) || "XT1650".equals(Util.MODEL))) {
    // Samsung devices running Nougat are known to be broken. See
    // https://github.com/google/ExoPlayer/issues/3373 and [Internal: b/37197802].
    // Moto Z XT1650 is also affected. See
    // https://github.com/google/ExoPlayer/issues/3215.
    return SECURE_MODE_NONE;
  }
  if (Util.SDK_INT < 26 && !context.getPackageManager().hasSystemFeature(
      PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE)) {
    // Pre API level 26 devices were not well tested unless they supported VR mode.
    return SECURE_MODE_NONE;
  }
  EGLDisplay display = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
  String eglExtensions = EGL14.eglQueryString(display, EGL10.EGL_EXTENSIONS);
  if (eglExtensions == null) {
    return SECURE_MODE_NONE;
  }
  if (!eglExtensions.contains(EXTENSION_PROTECTED_CONTENT)) {
    return SECURE_MODE_NONE;
  }
  // If we can't use surfaceless contexts, we use a protected 1 * 1 pixel buffer surface. This may
  // require support for EXT_protected_surface, but in practice it works on some devices that
  // don't have that extension. See also https://github.com/google/ExoPlayer/issues/3558.
  return eglExtensions.contains(EXTENSION_SURFACELESS_CONTEXT)
      ? SECURE_MODE_SURFACELESS_CONTEXT
      : SECURE_MODE_PROTECTED_PBUFFER;
}
 
Example #11
Source File: DummySurface.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public DummySurface init(@SecureMode int secureMode) {
  start();
  handler = new Handler(getLooper(), /* callback= */ this);
  eglSurfaceTexture = new EGLSurfaceTexture(handler);
  boolean wasInterrupted = false;
  synchronized (this) {
    handler.obtainMessage(MSG_INIT, secureMode, 0).sendToTarget();
    while (surface == null && initException == null && initError == null) {
      try {
        wait();
      } catch (InterruptedException e) {
        wasInterrupted = true;
      }
    }
  }
  if (wasInterrupted) {
    // Restore the interrupted status.
    Thread.currentThread().interrupt();
  }
  if (initException != null) {
    throw initException;
  } else if (initError != null) {
    throw initError;
  } else {
    return Assertions.checkNotNull(surface);
  }
}
 
Example #12
Source File: DummySurface.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void initInternal(@SecureMode int secureMode) {
  Assertions.checkNotNull(eglSurfaceTexture);
  eglSurfaceTexture.init(secureMode);
  this.surface =
      new DummySurface(
          this, eglSurfaceTexture.getSurfaceTexture(), secureMode != SECURE_MODE_NONE);
}
 
Example #13
Source File: DummySurface.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@TargetApi(24)
private static @SecureMode int getSecureModeV24(Context context) {
  if (Util.SDK_INT < 26 && ("samsung".equals(Util.MANUFACTURER) || "XT1650".equals(Util.MODEL))) {
    // Samsung devices running Nougat are known to be broken. See
    // https://github.com/google/ExoPlayer/issues/3373 and [Internal: b/37197802].
    // Moto Z XT1650 is also affected. See
    // https://github.com/google/ExoPlayer/issues/3215.
    return SECURE_MODE_NONE;
  }
  if (Util.SDK_INT < 26 && !context.getPackageManager().hasSystemFeature(
      PackageManager.FEATURE_VR_MODE_HIGH_PERFORMANCE)) {
    // Pre API level 26 devices were not well tested unless they supported VR mode.
    return SECURE_MODE_NONE;
  }
  EGLDisplay display = EGL14.eglGetDisplay(EGL14.EGL_DEFAULT_DISPLAY);
  String eglExtensions = EGL14.eglQueryString(display, EGL10.EGL_EXTENSIONS);
  if (eglExtensions == null) {
    return SECURE_MODE_NONE;
  }
  if (!eglExtensions.contains(EXTENSION_PROTECTED_CONTENT)) {
    return SECURE_MODE_NONE;
  }
  // If we can't use surfaceless contexts, we use a protected 1 * 1 pixel buffer surface. This may
  // require support for EXT_protected_surface, but in practice it works on some devices that
  // don't have that extension. See also https://github.com/google/ExoPlayer/issues/3558.
  return eglExtensions.contains(EXTENSION_SURFACELESS_CONTEXT)
      ? SECURE_MODE_SURFACELESS_CONTEXT
      : SECURE_MODE_PROTECTED_PBUFFER;
}
 
Example #14
Source File: DummySurface.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public DummySurface init(@SecureMode int secureMode) {
  start();
  handler = new Handler(getLooper(), /* callback= */ this);
  eglSurfaceTexture = new EGLSurfaceTexture(handler);
  boolean wasInterrupted = false;
  synchronized (this) {
    handler.obtainMessage(MSG_INIT, secureMode, 0).sendToTarget();
    while (surface == null && initException == null && initError == null) {
      try {
        wait();
      } catch (InterruptedException e) {
        wasInterrupted = true;
      }
    }
  }
  if (wasInterrupted) {
    // Restore the interrupted status.
    Thread.currentThread().interrupt();
  }
  if (initException != null) {
    throw initException;
  } else if (initError != null) {
    throw initError;
  } else {
    return Assertions.checkNotNull(surface);
  }
}
 
Example #15
Source File: DummySurface.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void initInternal(@SecureMode int secureMode) {
  Assertions.checkNotNull(eglSurfaceTexture);
  eglSurfaceTexture.init(secureMode);
  this.surface =
      new DummySurface(
          this, eglSurfaceTexture.getSurfaceTexture(), secureMode != SECURE_MODE_NONE);
}