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(); codec.start();
try { try {
alive = encode(codec, fd); alive = encode(codec, fd);
} finally { // do not call stop() on exception, it would trigger an IllegalStateException
codec.stop(); codec.stop();
} finally {
destroyDisplay(display); destroyDisplay(display);
codec.release(); codec.release();
surface.release(); surface.release();