Skip to content
Merged
Changes from 16 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
dec3d69
Merge remote-tracking branch 'upstream/main' into camx_occ
camsim99 May 1, 2023
0e0333b
Merge remote-tracking branch 'upstream/main'
camsim99 May 2, 2023
bd7ac99
Merge remote-tracking branch 'upstream/main'
camsim99 May 3, 2023
5c3363b
Merge remote-tracking branch 'upstream/main'
camsim99 May 10, 2023
fed9621
Undo changes
camsim99 May 10, 2023
5aabe34
Merge remote-tracking branch 'upstream/main'
camsim99 May 12, 2023
2b9a352
Merge remote-tracking branch 'upstream/main'
camsim99 May 25, 2023
a1173da
Merge remote-tracking branch 'upstream/main'
camsim99 May 30, 2023
cbc3d6b
Merge remote-tracking branch 'upstream/main'
camsim99 May 30, 2023
cae5a4c
Merge remote-tracking branch 'upstream/main'
camsim99 Jun 1, 2023
72283db
Merge remote-tracking branch 'upstream/main'
camsim99 Jun 5, 2023
166a77c
Merge remote-tracking branch 'upstream/main'
camsim99 Jun 5, 2023
399780e
Merge remote-tracking branch 'upstream/main'
camsim99 Jun 14, 2023
8d5d0e7
Merge remote-tracking branch 'upstream/main'
camsim99 Jun 26, 2023
8de6de1
Make fixes
camsim99 Jun 27, 2023
f731d64
Merge remote-tracking branch 'upstream/main' into xi_debug
camsim99 Jun 27, 2023
0710eb8
Initial stab at tests
camsim99 Jun 27, 2023
72365fa
Test attmept 2
camsim99 Jun 27, 2023
4bb3601
some test fixes
camsim99 Jun 27, 2023
7a45621
Test changes, removed test for ease
camsim99 Jun 27, 2023
73168b5
Add fix for invalid use of matchers
camsim99 Jun 28, 2023
69d7ffe
add debug notes
camsim99 Jun 28, 2023
30a8880
Bump version
camsim99 Jun 28, 2023
3abad3b
Mock prepareMediaRecorder
camsim99 Jun 28, 2023
9e44f56
Change camera to spy for mock
camsim99 Jun 28, 2023
c493b9d
Merge remote-tracking branch 'upstream/main' into xi_debug
camsim99 Jun 28, 2023
22ebff0
Mock prepareRecording
camsim99 Jun 28, 2023
7d39d57
Bump times because createCaptureSession
camsim99 Jun 28, 2023
48177de
Bump times because createCaptureSession
camsim99 Jun 28, 2023
6f9e085
Uncomment other tests, add comments
camsim99 Jun 28, 2023
a0af9cc
Add back imports
camsim99 Jun 28, 2023
ce3c25c
Add one last comment
camsim99 Jun 28, 2023
ede8e88
format
camsim99 Jun 28, 2023
bcfa57c
Refactor and check if surface mock needed
camsim99 Jun 28, 2023
6c1ba5e
fix tests
camsim99 Jun 28, 2023
abf390f
Formatting
camsim99 Jun 28, 2023
00ce873
Add mock for test
camsim99 Jun 28, 2023
10331d6
Correct to 2
camsim99 Jun 28, 2023
c29896c
Merge remote-tracking branch 'upstream/main' into xi_debug
camsim99 Jun 28, 2023
d9347f9
Formatting
camsim99 Jun 28, 2023
020a5e2
I'm not sure why I'm getting so confused
camsim99 Jun 28, 2023
ea9c373
format
camsim99 Jun 28, 2023
f784750
Add periods
camsim99 Jun 28, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import android.hardware.camera2.params.SessionConfiguration;
import android.media.CamcorderProfile;
import android.media.EncoderProfiles;
import android.media.Image;
import android.media.ImageReader;
import android.media.MediaRecorder;
import android.os.Build;
Expand Down Expand Up @@ -414,8 +415,13 @@ private void createCaptureSession(

List<Surface> remainingSurfaces = Arrays.asList(surfaces);
if (templateType != CameraDevice.TEMPLATE_PREVIEW) {
// If it is not preview mode, add all surfaces as targets.
// If it is not preview mode, add all surfaces as targets
// except the surface used for still capture as this should
// not be part of a repeating request.
for (Surface surface : remainingSurfaces) {
if (surface == pictureImageReader.getSurface()) {
continue;
}
previewRequestBuilder.addTarget(surface);
}
}
Expand Down Expand Up @@ -539,6 +545,10 @@ private void startCapture(boolean record, boolean stream) throws CameraAccessExc
surfaces.add(imageStreamReader.getSurface());
}

// Add pictureImageReader surface to allow for still capture
// during recording/image streaming.
surfaces.add(pictureImageReader.getSurface());

createCaptureSession(
CameraDevice.TEMPLATE_RECORD, successCallback, surfaces.toArray(new Surface[0]));
}
Expand Down Expand Up @@ -659,7 +669,6 @@ public void onCaptureCompleted(
};

try {
captureSession.stopRepeating();

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated fix: This call should not be necessary for still capture to proceed.

Log.i(TAG, "sending capture request");
captureSession.capture(stillBuilder.build(), captureCallback, backgroundHandler);
} catch (CameraAccessException e) {
Expand Down Expand Up @@ -1140,10 +1149,15 @@ public void startPreviewWithImageStream(EventChannel imageStreamChannel)
public void onImageAvailable(ImageReader reader) {
Log.i(TAG, "onImageAvailable");

// Use acquireNextImage since image reader is only for one image.
Image image = reader.acquireNextImage();
if (image == null) {
return;
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unrelated fix: acquireNextImage may return null, so added null check.

backgroundHandler.post(
new ImageSaver(
// Use acquireNextImage since image reader is only for one image.
reader.acquireNextImage(),
image,
captureFile,
new ImageSaver.Callback() {
@Override
Expand Down