Commit 57faa497 by Oliver Woodman

Fix crash running ExoPlayer demo on JB. My bad!

- We can't refer to UnsupportedSchemeException outside of the
V18 compat inner classes.
- There were also a few missing return; calls.
parent 11eb1c22
...@@ -163,12 +163,8 @@ public class DashRendererBuilder implements RendererBuilder, ...@@ -163,12 +163,8 @@ public class DashRendererBuilder implements RendererBuilder,
// HD streams require L1 security. // HD streams require L1 security.
filterHdContent = videoAdaptationSet != null && videoAdaptationSet.hasContentProtection() filterHdContent = videoAdaptationSet != null && videoAdaptationSet.hasContentProtection()
&& !drmSessionManagerData.second; && !drmSessionManagerData.second;
} catch (UnsupportedSchemeException e) { } catch (UnsupportedDrmException e) {
callback.onRenderersError( callback.onRenderersError(e);
new UnsupportedDrmException(UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME, e));
} catch (Exception e) {
callback.onRenderersError(
new UnsupportedDrmException(UnsupportedDrmException.REASON_UNKNOWN, e));
return; return;
} }
} }
...@@ -328,12 +324,18 @@ public class DashRendererBuilder implements RendererBuilder, ...@@ -328,12 +324,18 @@ public class DashRendererBuilder implements RendererBuilder,
private static class V18Compat { private static class V18Compat {
public static Pair<DrmSessionManager, Boolean> getDrmSessionManagerData(DemoPlayer player, public static Pair<DrmSessionManager, Boolean> getDrmSessionManagerData(DemoPlayer player,
MediaDrmCallback drmCallback) throws UnsupportedSchemeException { MediaDrmCallback drmCallback) throws UnsupportedDrmException {
StreamingDrmSessionManager streamingDrmSessionManager = new StreamingDrmSessionManager( try {
DemoUtil.WIDEVINE_UUID, player.getPlaybackLooper(), drmCallback, null, StreamingDrmSessionManager streamingDrmSessionManager = new StreamingDrmSessionManager(
player.getMainHandler(), player); DemoUtil.WIDEVINE_UUID, player.getPlaybackLooper(), drmCallback, null,
return Pair.create((DrmSessionManager) streamingDrmSessionManager, player.getMainHandler(), player);
getWidevineSecurityLevel(streamingDrmSessionManager) == SECURITY_LEVEL_1); return Pair.create((DrmSessionManager) streamingDrmSessionManager,
getWidevineSecurityLevel(streamingDrmSessionManager) == SECURITY_LEVEL_1);
} catch (UnsupportedSchemeException e) {
throw new UnsupportedDrmException(UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME);
} catch (Exception e) {
throw new UnsupportedDrmException(UnsupportedDrmException.REASON_UNKNOWN, e);
}
} }
private static int getWidevineSecurityLevel(StreamingDrmSessionManager sessionManager) { private static int getWidevineSecurityLevel(StreamingDrmSessionManager sessionManager) {
......
...@@ -118,12 +118,8 @@ public class SmoothStreamingRendererBuilder implements RendererBuilder, ...@@ -118,12 +118,8 @@ public class SmoothStreamingRendererBuilder implements RendererBuilder,
try { try {
drmSessionManager = V18Compat.getDrmSessionManager(manifest.protectionElement.uuid, player, drmSessionManager = V18Compat.getDrmSessionManager(manifest.protectionElement.uuid, player,
drmCallback); drmCallback);
} catch (UnsupportedSchemeException e) { } catch (UnsupportedDrmException e) {
callback.onRenderersError( callback.onRenderersError(e);
new UnsupportedDrmException(UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME, e));
} catch (Exception e) {
callback.onRenderersError(
new UnsupportedDrmException(UnsupportedDrmException.REASON_UNKNOWN, e));
return; return;
} }
} }
...@@ -259,9 +255,15 @@ public class SmoothStreamingRendererBuilder implements RendererBuilder, ...@@ -259,9 +255,15 @@ public class SmoothStreamingRendererBuilder implements RendererBuilder,
private static class V18Compat { private static class V18Compat {
public static DrmSessionManager getDrmSessionManager(UUID uuid, DemoPlayer player, public static DrmSessionManager getDrmSessionManager(UUID uuid, DemoPlayer player,
MediaDrmCallback drmCallback) throws UnsupportedSchemeException { MediaDrmCallback drmCallback) throws UnsupportedDrmException {
return new StreamingDrmSessionManager(uuid, player.getPlaybackLooper(), drmCallback, null, try {
player.getMainHandler(), player); return new StreamingDrmSessionManager(uuid, player.getPlaybackLooper(), drmCallback, null,
player.getMainHandler(), player);
} catch (UnsupportedSchemeException e) {
throw new UnsupportedDrmException(UnsupportedDrmException.REASON_UNSUPPORTED_SCHEME);
} catch (Exception e) {
throw new UnsupportedDrmException(UnsupportedDrmException.REASON_UNKNOWN, e);
}
} }
} }
......
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