Skip to content

Commit

Permalink
Prevent forwarding of zero video size to Leanback
Browse files Browse the repository at this point in the history
Leanback isn't prepared to handle these values and will throw
ArithmeticExceptions.

Issue: #617
PiperOrigin-RevId: 561413740
  • Loading branch information
tonihei authored and Copybara-Service committed Aug 30, 2023
1 parent 53b882d commit ba4b96d
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
3 changes: 3 additions & 0 deletions RELEASENOTES.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@
([#577](https://github.com/androidx/media/issues/577)).
* Decoder Extensions (FFmpeg, VP9, AV1, etc.):
* MIDI extension:
* Leanback extension:
* Fix bug where disabling a surface can cause an `ArithmeticException` in
Leanback code ([#617](https://github.com/androidx/media/issues/617)).
* Cast Extension:
* Test Utilities:
* Remove deprecated symbols:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,11 @@ public void onPositionDiscontinuity(
@SuppressWarnings("nullness:dereference.of.nullable")
@Override
public void onVideoSizeChanged(VideoSize videoSize) {
if (videoSize.width == 0 || videoSize.height == 0) {
// Do not report unknown or placeholder sizes as Leanback can't handle these cases correctly
// (see https://github.com/androidx/media/issues/617).
return;
}
// There's no way to pass pixelWidthHeightRatio to leanback, so we scale the width that we
// pass to take it into account. This is necessary to ensure that leanback uses the correct
// aspect ratio when playing content with non-square pixels.
Expand Down

0 comments on commit ba4b96d

Please sign in to comment.