mirror of
https://github.com/samsonjs/media.git
synced 2026-03-28 09:55:48 +00:00
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
This commit is contained in:
parent
c1e0d77389
commit
07f66ea469
2 changed files with 3 additions and 8 deletions
|
|
@ -80,7 +80,6 @@ public final class DummySurface extends Surface {
|
|||
* {@link #isSecureSupported(Context)} returns {@code false}.
|
||||
*/
|
||||
public static DummySurface newInstanceV17(Context context, boolean secure) {
|
||||
assertApiLevel17OrHigher();
|
||||
Assertions.checkState(!secure || isSecureSupported(context));
|
||||
DummySurfaceThread thread = new DummySurfaceThread();
|
||||
return thread.init(secure ? secureMode : SECURE_MODE_NONE);
|
||||
|
|
@ -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
|
||||
private static int getSecureMode(Context context) {
|
||||
if (GlUtil.isProtectedContentExtensionSupported(context)) {
|
||||
|
|
|
|||
|
|
@ -641,7 +641,9 @@ public class MediaCodecVideoRenderer extends MediaCodecRenderer {
|
|||
deviceNeedsNoPostProcessWorkaround,
|
||||
tunnelingAudioSessionId);
|
||||
if (surface == null) {
|
||||
Assertions.checkState(shouldUseDummySurface(codecInfo));
|
||||
if (!shouldUseDummySurface(codecInfo)) {
|
||||
throw new IllegalStateException();
|
||||
}
|
||||
if (dummySurface == null) {
|
||||
dummySurface = DummySurface.newInstanceV17(context, codecInfo.secure);
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue