Do not call codec.stop() on exception

On exception, the codec is not in a state were .stop() can be called.
This commit is contained in:
Romain Vimont 2019-03-21 18:45:29 +01:00
parent a16cf95b8e
commit 3eda38e5fc

View file

@ -71,8 +71,9 @@ public class ScreenEncoder implements Device.RotationListener {
codec.start();
try {
alive = encode(codec, fd);
} finally {
// do not call stop() on exception, it would trigger an IllegalStateException
codec.stop();
} finally {
destroyDisplay(display);
codec.release();
surface.release();