fix:Do not call codec.stop() on exception

This commit is contained in:
Barry 2019-06-18 15:29:11 +08:00
commit fd86b98a32

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();