Commit 8554cf5a by olly Committed by Ian Baker

Handle Choreographer.getInstance throwing RuntimeException

#minor-release

PiperOrigin-RevId: 427439588
parent 41a1423a
...@@ -620,22 +620,31 @@ public final class VideoFrameReleaseHelper { ...@@ -620,22 +620,31 @@ public final class VideoFrameReleaseHelper {
} }
private void createChoreographerInstanceInternal() { private void createChoreographerInstanceInternal() {
try {
choreographer = Choreographer.getInstance(); choreographer = Choreographer.getInstance();
} catch (RuntimeException e) {
// See [Internal: b/213926330].
Log.w(TAG, "Vsync sampling disabled due to platform error", e);
}
} }
private void addObserverInternal() { private void addObserverInternal() {
if (choreographer != null) {
observerCount++; observerCount++;
if (observerCount == 1) { if (observerCount == 1) {
checkNotNull(choreographer).postFrameCallback(this); choreographer.postFrameCallback(this);
}
} }
} }
private void removeObserverInternal() { private void removeObserverInternal() {
if (choreographer != null) {
observerCount--; observerCount--;
if (observerCount == 0) { if (observerCount == 0) {
checkNotNull(choreographer).removeFrameCallback(this); choreographer.removeFrameCallback(this);
sampledVsyncTimeNs = C.TIME_UNSET; sampledVsyncTimeNs = C.TIME_UNSET;
} }
} }
} }
}
} }
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