Skip to content
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

Need release after onPlayerError #5464

Closed
sneltyn opened this issue Feb 1, 2019 · 5 comments
Closed

Need release after onPlayerError #5464

sneltyn opened this issue Feb 1, 2019 · 5 comments
Assignees
Labels

Comments

@sneltyn
Copy link

sneltyn commented Feb 1, 2019

Do I need to release a player after an error? This link https://github.com/sneltyn/ExoPreload is a demo that demonstrates the problem (if it is a problem). The demo shows how the player gets stuck on state STATE_BUFFERING

During the launch of the demo, turn off the Internet;)

The demo does the preloading of the HLS or mp4 using the ConcatenatingMediaSource

Maybe I'm doing something wrong.

ExoPlayer: 2.9.4

@ojw28
Copy link
Contributor

ojw28 commented Feb 1, 2019

You should always call release when you no longer require the player instance. However, a player can be re-used (e.g. re-prepared) after an error occurs. So if you plan on re-using the player after the error, you should not call release at that point.

@ojw28 ojw28 self-assigned this Feb 1, 2019
@ojw28 ojw28 added the question label Feb 1, 2019
@sneltyn
Copy link
Author

sneltyn commented Feb 1, 2019

@ojw28 thank! Then I do everything right, but after the error the player can no longer play anything. Please see the demo.

@ojw28 ojw28 assigned tonihei and unassigned ojw28 Feb 3, 2019
@ojw28
Copy link
Contributor

ojw28 commented Feb 3, 2019

@tonihei - Could you take a look at this? Could be wrong, but it looks like the player has a ConcatenatingMediaSource containing a single ClippingMediaSource, which wraps an ExtractorMediaSource. Before the second prepare call the ConcatenatingMediaSource is cleared and a new ClippingMediaSource -> ExtractorMediaSource is added. The player then ends up stuck in the buffering state.

It looks like replacing the ConcatenatingMediaSource with a new instance rather than clearing it solves the problem, but this shouldn't be necessary?

@ojw28 ojw28 added bug and removed question labels Feb 3, 2019
@ojw28
Copy link
Contributor

ojw28 commented Feb 3, 2019

A little extra info: It looks like ConcatenatingMediaSource.scheduleListenerNotification is called (sets listenerNotificationScheduled=true and posts MSG_NOTIFY_LISTENER). Then ConcatenatingMediaSource.releaseSourceInternal is called (removes MSG_NOTIFY_LISTENER). From that point on scheduleListenerNotification is broken, because listenerNotificationScheduled=true even though there's no pending MSG_NOTIFY_LISTENER.

I guess releaseSourceInternal needs to set listenerNotificationScheduled=false, but I'm not sure what should happen to pendingOnCompletionActions. Maybe they all need dispatching in releaseSourceInternal?

ojw28 pushed a commit that referenced this issue Feb 4, 2019
When calling releaseSource(), all pending messages will be removed. That means
that all action-on-completion callbacks which are somewhere in flight are
just dropped without being called. This change adds code to keep track of the
current state of each callback to allow all of them being called when the
source is released.

Issue:#5464
PiperOrigin-RevId: 232312528
@ojw28
Copy link
Contributor

ojw28 commented Feb 4, 2019

Fixed in dev-v2. The fix will be part of 2.9.5.

ojw28 pushed a commit that referenced this issue Feb 4, 2019
When calling releaseSource(), all pending messages will be removed. That means
that all action-on-completion callbacks which are somewhere in flight are
just dropped without being called. This change adds code to keep track of the
current state of each callback to allow all of them being called when the
source is released.

Issue:#5464
PiperOrigin-RevId: 232312528
@ojw28 ojw28 closed this as completed Feb 4, 2019
stari4ek pushed a commit to stari4ek/ExoPlayer that referenced this issue Feb 18, 2019
When calling releaseSource(), all pending messages will be removed. That means
that all action-on-completion callbacks which are somewhere in flight are
just dropped without being called. This change adds code to keep track of the
current state of each callback to allow all of them being called when the
source is released.

Issue:google#5464
PiperOrigin-RevId: 232312528
@google google locked and limited conversation to collaborators Aug 5, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

3 participants