mirror of
https://github.com/androidx/media.git
synced 2025-05-08 16:10:38 +08:00

Currently we don't remove the AnalyticsListeners registed to SimpleExoPlayer after calling release. We didn't do this mainly because there are messages triggered as part of the release that still cause interesting events (e.g. decoderDisabled with the final counters, final dropped counts etc). However, we should fully release/remove the listeners once these pending events are delivered to: 1. Not leak listener implementations (e.g. if the listener is an Activity) 2. Ensure we don't send future events that may cause listeners to unintentionally access released or nulled variables. This could happen for example if someone calls a player method after the player was released. In addition, we can add a onPlayerReleased callback to AnalyticsListener to allow implementations to clean themselves up once all pending events are delivered. PiperOrigin-RevId: 347434344