Commit 07f66ea4 by andrewlewis Committed by Ian Baker

Fix NewApi error for DummySurface usage

API level >= 17 is guaranteed by shouldUseDummySurface returning true,
but Android Studio shows a warning anyway.

PiperOrigin-RevId: 295118491
parent c1e0d773
...@@ -80,7 +80,6 @@ public final class DummySurface extends Surface { ...@@ -80,7 +80,6 @@ public final class DummySurface extends Surface {
* {@link #isSecureSupported(Context)} returns {@code false}. * {@link #isSecureSupported(Context)} returns {@code false}.
*/ */
public static DummySurface newInstanceV17(Context context, boolean secure) { public static DummySurface newInstanceV17(Context context, boolean secure) {
assertApiLevel17OrHigher();
Assertions.checkState(!secure || isSecureSupported(context)); Assertions.checkState(!secure || isSecureSupported(context));
DummySurfaceThread thread = new DummySurfaceThread(); DummySurfaceThread thread = new DummySurfaceThread();
return thread.init(secure ? secureMode : SECURE_MODE_NONE); return thread.init(secure ? secureMode : SECURE_MODE_NONE);
...@@ -107,12 +106,6 @@ public final class DummySurface extends Surface { ...@@ -107,12 +106,6 @@ public final class DummySurface extends Surface {
} }
} }
private static void assertApiLevel17OrHigher() {
if (Util.SDK_INT < 17) {
throw new UnsupportedOperationException("Unsupported prior to API level 17");
}
}
@SecureMode @SecureMode
private static int getSecureMode(Context context) { private static int getSecureMode(Context context) {
if (GlUtil.isProtectedContentExtensionSupported(context)) { if (GlUtil.isProtectedContentExtensionSupported(context)) {
......
...@@ -641,7 +641,9 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer { ...@@ -641,7 +641,9 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
deviceNeedsNoPostProcessWorkaround, deviceNeedsNoPostProcessWorkaround,
tunnelingAudioSessionId); tunnelingAudioSessionId);
if (surface == null) { if (surface == null) {
Assertions.checkState(shouldUseDummySurface(codecInfo)); if (!shouldUseDummySurface(codecInfo)) {
throw new IllegalStateException();
}
if (dummySurface == null) { if (dummySurface == null) {
dummySurface = DummySurface.newInstanceV17(context, codecInfo.secure); dummySurface = DummySurface.newInstanceV17(context, codecInfo.secure);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment