Commit 8d942dc2 by ibaker Committed by marcbaechinger

Simplify release event logic in DefaultDrmSession

This is a no-op assuming the class is always used correctly.
When release causes referenceCount to reach zero there can be at most
one EventDispatcher still connected (which is the one that must be
passed to that final release() call), so we can always pass the event
directly to the EventDispatcher passed in to release().

PiperOrigin-RevId: 358794004
parent 399e1365
......@@ -321,14 +321,10 @@ import org.checkerframework.checker.nullness.qual.RequiresNonNull;
mediaDrm.closeSession(sessionId);
sessionId = null;
}
dispatchEvent(DrmSessionEventListener.EventDispatcher::drmSessionReleased);
}
if (eventDispatcher != null) {
if (isOpen()) {
// If the session is still open then send the release event only to the provided dispatcher
// before removing it.
eventDispatcher.drmSessionReleased();
}
// Acquire and release events are only sent to the provided dispatcher.
eventDispatcher.drmSessionReleased();
eventDispatchers.remove(eventDispatcher);
}
referenceCountListener.onReferenceCountDecremented(this, referenceCount);
......
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