Skip to content

ArithmeticException: divide by zero #617

Closed
@TheBeastLT

Description

@TheBeastLT

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

  • You will email the zip file produced by adb bugreport to [email protected] after filing this issue.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions