pull/431/head
Mattia Iavarone 6 years ago
parent 407b2d4e64
commit 1b262f2e28
  1. 21
      cameraview/src/androidTest/java/com/otaliastudios/cameraview/IntegrationTest.java

@ -6,6 +6,7 @@ import android.graphics.PointF;
import android.hardware.Camera;
import android.os.Build;
import androidx.annotation.NonNull;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import androidx.test.filters.MediumTest;
import androidx.test.rule.ActivityTestRule;
@ -29,6 +30,7 @@ import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.any;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.spy;
/**
@ -597,5 +599,24 @@ public class IntegrationTest extends BaseTest {
assert30Frames(processor);
}
@Test
public void testFrameProcessing_freezeRelease() throws Exception {
// Ensure that freeze/release cycles do not cause OOMs.
// There was a bug doing this and it might resurface for any improper
// disposal of the frames.
FrameProcessor source = new FrameProcessor() {
@Override
public void process(@NonNull Frame frame) {
frame.freeze().release();
}
};
FrameProcessor processor = spy(source);
camera.addFrameProcessor(processor);
waitForOpen(true);
assert30Frames(processor);
}
//endregion
}

Loading…
Cancel
Save