Limit retry-on-error to IllegalStateException

MediaCodec errors always trigger IllegalStateException or a subtype
(like MediaCodec.CodecException).

In practice, this avoids to retry if the error is caused by an
IOException when writing the video packet to the socket.
raw_video_stream
Romain Vimont 2 years ago
parent 2eb6fe7d81
commit 262506c733

@ -99,7 +99,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 (Exception e) {
} catch (IllegalStateException e) {
Ln.e("Encoding error: " + e.getClass().getName() + ": " + e.getMessage());
if (!downsizeOnError || firstFrameSent) {
// Fail immediately

Loading…
Cancel
Save