private final int id;
private final Camera.CameraInfo info;
private final OrientationEventListener orientationListener;
+ private boolean orientationListenerEnabled;
private final long native_capturer; // |VideoCaptureAndroid*| in C++.
private SurfaceTexture cameraSurfaceTexture;
private int[] cameraGlTextures = null;
final VideoCaptureAndroid self = this;
orientationListener = new OrientationEventListener(GetContext()) {
@Override public void onOrientationChanged(int degrees) {
+ if (!self.orientationListenerEnabled) {
+ return;
+ }
if (degrees == OrientationEventListener.ORIENTATION_UNKNOWN) {
return;
}
}
});
boolean startResult = exchange(result, false); // |false| is a dummy value.
+ orientationListenerEnabled = true;
orientationListener.enable();
return startResult;
}
private synchronized boolean stopCapture() {
Log.d(TAG, "stopCapture");
orientationListener.disable();
+ orientationListenerEnabled = false;
final Exchanger<Boolean> result = new Exchanger<Boolean>();
cameraThreadHandler.post(new Runnable() {
@Override public void run() {