-
Notifications
You must be signed in to change notification settings - Fork 390
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorporate MediaSourceEventListener.onLoadStarted with retryCount pa… #1768
base: main
Are you sure you want to change the base?
Conversation
…rameter with backward compatibility
I think in its current form this stops calling any existing implementations of We need to keep these implementations working - because although they're marked as deprecated, deprecated things are still expected to work. Ensuring both the old and new callbacks continue working, without accidentally multiplying the calls, is somewhat tricky (you mentioned you experimented with putting some duplication in the We can put the duplication in the callsites instead (i.e. in each |
libraries/exoplayer/src/main/java/androidx/media3/exoplayer/source/ProgressiveMediaPeriod.java
Outdated
Show resolved
Hide resolved
@@ -2199,6 +2200,15 @@ public void onLoadStarted( | |||
reportedEvents.add(new ReportedEvent(EVENT_LOAD_STARTED, eventTime)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you might need to use a different event type here, so we can test that both the new method and the old method are called
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any naming convention to suggest here? I was thinking EVENT_ON_LOAD_STARTED
but not sure if that is confusing and outside of Google's naming conventions
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What about keeping EVENT_LOAD_STARTED
for the new un-deprecated one and renaming the old one to EVENT_LOAD_STARTED_WITHOUT_RETRY_COUNT
? It's a bit long, but it only needs to live as long as we keep the deprecated method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah because i was reading this in a test, i thought this constant was defined in the test - my bad, now i see it's defined in AnalyticsListener
interface.
In that case i retract my comment, we shouldn't duplicate this constant imo - we should find a different way to test that both the new and old methods are called.
@Nullable | ||
MediaPeriodImpl mediaPeriod = | ||
getMediaPeriodForEvent(mediaPeriodId, mediaLoadData, /* useLoadingPeriod= */ true); | ||
if (mediaPeriod == null) { | ||
mediaSourceEventDispatcherWithoutId.loadStarted(loadEventInfo, mediaLoadData); | ||
mediaSourceEventDispatcherWithoutId.loadStarted(loadEventInfo, mediaLoadData, retryCount); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this call (and the one below in this method) are basically forwarding from an inner MediaSource
instance. SImilar to CompositeMediaSource.ForwardingEventListener
we should implement both the old and new methods here, and forward each one to the respective EventDispatcher
method.
Otherwise a custom MediaSource
that hasn't yet switched to dispatching the new method will have all its onLoadStarted
events dropped at this point.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Makes a lot of sense. Will do!
...aries/exoplayer/src/main/java/androidx/media3/exoplayer/source/MediaSourceEventListener.java
Outdated
Show resolved
Hide resolved
Thanks for the feedback and makes sense. I think duplicating the calls at each callsite makes sense to me since this is treating the updated API as a new API entirely. This seems cleaner too. I will adjust this |
…rameter with backward compatibility