VideoCaptureAndroid: stop preview in opposite order of starting.

While the SDK documentation doesn't prescribe a required shutdown order, good
hygiene suggests stopping should happen in reverse order of starting.  It also
seems to relieve a crash in the system capturer on at least the Galaxy Note 10.

BUG=2793
R=henrike@webrtc.org

Review URL: https://webrtc-codereview.appspot.com/7549004

git-svn-id: http://webrtc.googlecode.com/svn/trunk@5445 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
fischman@webrtc.org 2014-01-27 22:32:05 +00:00
parent 18586d38bc
commit 932b0193e7

View File

@ -126,14 +126,14 @@ public class VideoCaptureAndroid implements PreviewCallback, Callback {
}
Throwable error = null;
try {
camera.stopPreview();
camera.setPreviewCallbackWithBuffer(null);
if (localPreview != null) {
localPreview.removeCallback(this);
camera.setPreviewDisplay(null);
} else {
camera.setPreviewTexture(null);
}
camera.setPreviewCallbackWithBuffer(null);
camera.stopPreview();
camera.release();
camera = null;
return true;