Also retry on IllegalArgumentException
MediaCodec.configure() may throw an IllegalArgumentException if it does
not support the requested size. Also retry on this exception.
Fixes <https://github.com/Genymobile/scrcpy/issues/2993>
Refs <https://github.com/Genymobile/scrcpy/pull/2947>
Refs <https://github.com/Genymobile/scrcpy/pull/2990>
PR <https://github.com/Genymobile/scrcpy/pull/3043>
@@ -102,7 +102,7 @@ public class ScreenEncoder implements Device.RotationListener {
alive = encode(codec, fd);
// do not call stop() on exception, it would trigger an IllegalStateException
codec.stop();
- } catch (IllegalStateException e) {
+ } catch (IllegalStateException | IllegalArgumentException e) {
Ln.e("Encoding error: " + e.getClass().getName() + ": " + e.getMessage());
if (!downsizeOnError || firstFrameSent) {
// Fail immediately
