Prevent forwarding of zero video size to Leanback
Leanback isn't prepared to handle these values and will throw ArithmeticExceptions. Issue: androidx/media#617 PiperOrigin-RevId: 561413740
This commit is contained in:
parent
53b882d803
commit
ba4b96d2c1
@ -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:
|
||||
|
@ -286,6 +286,11 @@ public final class LeanbackPlayerAdapter extends PlayerAdapter implements Runnab
|
||||
@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.
|
||||
|
Loading…
x
Reference in New Issue
Block a user