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

ArithmeticException: divide by zero #617

Closed
1 task
TheBeastLT opened this issue Aug 28, 2023 · 1 comment
Closed
1 task

ArithmeticException: divide by zero #617

TheBeastLT opened this issue Aug 28, 2023 · 1 comment
Assignees
Labels

Comments

@TheBeastLT
Copy link

Version

Media3 1.1.0

More version details

No response

Devices that reproduce the issue

Any TV

Devices that do not reproduce the issue

No response

Reproducible in the demo app?

Yes

Reproduction steps

When using leanback player UI and playing a video which exceeds device capabilities your get and ArithmeticException: divide by zero.
This is probably due to this change:

Video:
Make MediaCodecVideoRenderer report a VideoSize with a width and height of 0 when the renderer is disabled. Player.Listener.onVideoSizeChanged is called accordingly when Player.getVideoSize() changes. With this change, ExoPlayer's video size with MediaCodecVideoRenderer has a width and height of 0 when Player.getCurrentTracks does not support video, or the size of the supported video track is not yet determined.

There are various listeners in leanback that propagate to VideoSupportFragment#onVideoSizeChanged where the exception happens.

Full stack trace:

java.lang.ArithmeticException: divide by zero
	at androidx.leanback.app.VideoSupportFragment.onVideoSizeChanged(VideoSupportFragment.java:102)
	at androidx.leanback.app.PlaybackSupportFragmentGlueHost$2.onVideoSizeChanged(PlaybackSupportFragmentGlueHost.java:130)
	at androidx.leanback.media.PlaybackBaseControlGlue$1.onVideoSizeChanged(PlaybackBaseControlGlue.java:178)
	at androidx.media3.ui.leanback.LeanbackPlayerAdapter$PlayerListener.onVideoSizeChanged(LeanbackPlayerAdapter.java:293)
	at androidx.media3.common.ForwardingPlayer$ForwardingListener.onVideoSizeChanged(ForwardingPlayer.java:1070)
	at androidx.media3.exoplayer.ExoPlayerImpl$ComponentListener.lambda$onVideoSizeChanged$0(ExoPlayerImpl.java:2939)
	at androidx.media3.exoplayer.ExoPlayerImpl$ComponentListener$$ExternalSyntheticLambda7.invoke(D8$$SyntheticClass)
	at androidx.media3.common.util.ListenerSet$ListenerHolder.invoke(ListenerSet.java:339)
	at androidx.media3.common.util.ListenerSet.lambda$queueEvent$0(ListenerSet.java:223)
	at androidx.media3.common.util.ListenerSet$$ExternalSyntheticLambda1.run(D8$$SyntheticClass)
	at androidx.media3.common.util.ListenerSet.flushEvents(ListenerSet.java:245)
	at androidx.media3.common.util.ListenerSet.sendEvent(ListenerSet.java:260)
	at androidx.media3.exoplayer.ExoPlayerImpl$ComponentListener.onVideoSizeChanged(ExoPlayerImpl.java:2938)
	at androidx.media3.exoplayer.video.VideoRendererEventListener$EventDispatcher.lambda$videoSizeChanged$5$androidx-media3-exoplayer-video-VideoRendererEventListener$EventDispatcher(VideoRendererEventListener.java:230)
	at androidx.media3.exoplayer.video.VideoRendererEventListener$EventDispatcher$$ExternalSyntheticLambda8.run(D8$$SyntheticClass)
	at android.os.Handler.handleCallback(Handler.java:739)
	at android.os.Handler.dispatchMessage(Handler.java:95)
	at android.os.Looper.loop(Looper.java:135)
	at android.app.ActivityThread.main(ActivityThread.java:5254)
	at java.lang.reflect.Method.invoke(Native Method)
	at java.lang.reflect.Method.invoke(Method.java:372)
	at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:903)
	at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:698)

Expected result

Previous versions would not throw this is device capabilities were exceeded.

Actual result

Fragment crashes

Media

Bug Report

@tonihei
Copy link
Collaborator

tonihei commented Aug 30, 2023

Thanks for reporting! We can fix that by not forwarding 0 values to Leanback (which seems not to handle them very well).

@tonihei tonihei self-assigned this Aug 30, 2023
copybara-service bot pushed a commit that referenced this issue Aug 30, 2023
Leanback isn't prepared to handle these values and will throw
ArithmeticExceptions.

Issue: #617
PiperOrigin-RevId: 561413740
copybara-service bot pushed a commit to google/ExoPlayer that referenced this issue Aug 30, 2023
Leanback isn't prepared to handle these values and will throw
ArithmeticExceptions.

Issue: androidx/media#617
PiperOrigin-RevId: 561413740
@tonihei tonihei closed this as completed Sep 8, 2023
microkatz pushed a commit to hugohlln/media that referenced this issue Sep 29, 2023
Leanback isn't prepared to handle these values and will throw
ArithmeticExceptions.

Issue: androidx#617
PiperOrigin-RevId: 561413740
@androidx androidx locked and limited conversation to collaborators Nov 8, 2023
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

2 participants