mirror of
https://github.com/androidx/media.git
synced 2025-04-30 06:46:50 +08:00

Doing so prevent Codec which is a big object with JNI to be garbage collected. As the codec can not be hold in the listener, there is no way to call release, as it must be called on the same codec. As a result the release method is also removed. The downside is that at runtime some callbacks may be dropped but it should be a short transitive state. This also simplifies lifecycle of the listener as the client does not have to know if release needs to be called or not. An alternative would have been to hold a weak ref, but I deemed it too complicated for the runtime gain. PiperOrigin-RevId: 290231659