In-line DashTestRunner.MediaDrmBuilder
This commit is contained in:
parent
868d2fedcb
commit
b82f341007
@ -105,17 +105,15 @@ import java.util.List;
|
||||
|
||||
@SuppressWarnings("ResourceType")
|
||||
public static boolean isL1WidevineAvailable(String mimeType) {
|
||||
try {
|
||||
try (MediaDrm mediaDrm = new MediaDrm(WIDEVINE_UUID)) {
|
||||
// Force L3 if secure decoder is not available.
|
||||
if (MediaCodecUtil.getDecoderInfo(mimeType, /* secure= */ true, /* tunneling= */ false)
|
||||
== null) {
|
||||
return false;
|
||||
}
|
||||
MediaDrm mediaDrm = MediaDrmBuilder.build();
|
||||
String securityProperty = mediaDrm.getPropertyString(SECURITY_LEVEL_PROPERTY);
|
||||
mediaDrm.release();
|
||||
return WIDEVINE_SECURITY_LEVEL_1.equals(securityProperty);
|
||||
} catch (MediaCodecUtil.DecoderQueryException e) {
|
||||
} catch (UnsupportedSchemeException | MediaCodecUtil.DecoderQueryException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
@ -503,19 +501,4 @@ import java.util.List;
|
||||
return RendererCapabilities.getFormatSupport(formatSupport) == C.FORMAT_HANDLED;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a new {@code MediaDrm} object. The encapsulation ensures that the tests can be executed
|
||||
* for API level < 18.
|
||||
*/
|
||||
private static final class MediaDrmBuilder {
|
||||
|
||||
public static MediaDrm build() {
|
||||
try {
|
||||
return new MediaDrm(WIDEVINE_UUID);
|
||||
} catch (UnsupportedSchemeException e) {
|
||||
throw new IllegalStateException(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user