mirror of
https://github.com/samsonjs/media.git
synced 2026-04-27 15:07:40 +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}.
|
* {@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 {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
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 {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue