Fix BaseFilter bug

egloo2
Mattia Iavarone 5 years ago
parent 7f1d5b26b7
commit f95c11cab9
  1. 7
      cameraview/src/main/java/com/otaliastudios/cameraview/filter/BaseFilter.java
  2. 6
      demo/src/main/java/com/otaliastudios/cameraview/demo/CameraActivity.java

@ -133,9 +133,10 @@ public abstract class BaseFilter implements Filter {
@Override
public void onDestroy() {
// NOTE: this destroys the GL program, but Filter consumers (GlTextureDrawer, MultiFilter)
// will destroy it too (just like they create it). Hope this doesn't cause any issue;
// if it does, we could avoid calling release here.
// Since we used the handle constructor of GlTextureProgram, calling release here
// will NOT destroy the GL program. This is important because Filters are not supposed
// to have ownership of programs. Creation and deletion happen outside, and deleting twice
// would cause an error.
program.release();
program = null;
}

@ -47,8 +47,8 @@ import java.util.List;
public class CameraActivity extends AppCompatActivity implements View.OnClickListener, OptionView.Callback {
private final static CameraLogger LOG = CameraLogger.create("DemoApp");
private final static boolean USE_FRAME_PROCESSOR = true;
private final static boolean DECODE_BITMAP = true;
private final static boolean USE_FRAME_PROCESSOR = false;
private final static boolean DECODE_BITMAP = false;
private CameraView camera;
private ViewGroup controlPanel;
@ -76,7 +76,7 @@ public class CameraActivity extends AppCompatActivity implements View.OnClickLis
long newTime = frame.getTime();
long delay = newTime - lastTime;
lastTime = newTime;
LOG.e("Frame delayMillis:", delay, "FPS:", 1000 / delay);
LOG.v("Frame delayMillis:", delay, "FPS:", 1000 / delay);
if (DECODE_BITMAP) {
if (frame.getFormat() == ImageFormat.NV21
&& frame.getDataClass() == byte[].class) {

Loading…
Cancel
Save