Skip to content

Commit

Permalink
acquire_abort with no tears (#34)
Browse files Browse the repository at this point in the history
* Remove additional camera_stop in acquire_abort().

* Revert "Remove additional camera_stop in acquire_abort()."

This reverts commit 1986628.

* Check camera is running on get_frame().

* Execute trigger abort, in case the camera is waiting on one.

* Update changelog.

* Update doc for `Camera.execute_trigger()`.
  • Loading branch information
aliddell authored Jan 19, 2024
1 parent 1e9f286 commit 6a1cb04
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Fixed

- A bug where changing device identifiers for the storage device was not being handled correctly.
- A race condition where `camera_get_frame()` might be called after `camera_stop()` when aborting acquisition.

### Changed

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ camera_get_frame(struct Camera* self,
struct ImageInfo* info)
{
CHECK(self);
CHECK(self->state == DeviceState_Running);
enum DeviceStatusCode ecode = self->get_frame(self, im, nbytes, info);
if (ecode != Device_Ok) {
camera_stop(self);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ extern "C"
/// (i.e. one call of start after one call of stop should succeed).
enum DeviceStatusCode (*stop)(struct Camera*);

/// @brief Execute the software trigger if it's enabled.
/// @brief Execute the software trigger.
enum DeviceStatusCode (*execute_trigger)(struct Camera*);

/// @brief Gets the next frame from the camera.
Expand Down
3 changes: 2 additions & 1 deletion acquire-video-runtime/src/acquire.c
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,8 @@ acquire_abort(struct AcquireRuntime* self_)

video->source.is_stopping = 1;
channel_accept_writes(&video->sink.in, 0);
camera_stop(video->source.camera);
// if the camera is waiting on a trigger, this will unblock it.
camera_execute_trigger(video->source.camera);
}

return acquire_stop(self_);
Expand Down

0 comments on commit 6a1cb04

Please sign in to comment.