Skip to content

General purpose camera pipeline in checkbox_support (New) #1741

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 23 commits into
base: main
Choose a base branch
from

Conversation

tomli380576
Copy link
Contributor

@tomli380576 tomli380576 commented Feb 20, 2025

Description

(This PR is the 1st part of the previously implemented automatic gstreamer pipeline PR that was too big)

This PR adds a general purpose pipeline runner run_pipeline in checkbox_support and an example driver code take_photo that takes a photo using this runner

Resolved issues

#1676 <-- was too big for review. The end goal is to have a test job that can enumerate every (device, capability) combination returned by gst-device-monitor and check if each combination can take a photo/record a video/show a viewfinder

Documentation

I drafted a short design doc to explain some of the weirdness/quirks in the code that might not be fully explained by the comments. Hopefully this helps with the review :)

Tests

Unit tests. Also tested on real devices with USB cameras using the following driver code

if __name__ == "__main__":
    Gst.init([])
    # replace the element with what's available on your system
    elem = Gst.parse_launch("pipewiresrc target-object=47")
    assert isinstance(elem, Gst.Element)
    take_photo(elem, file_path=Path("/home/ubuntu/photo.jpeg"), delay_seconds=3)

Intel MIPI are expected to fail for now since they are only accessible with v4l2src, which isn't exposed in DeviceMonitor. (aside: I think the desktop team is currently backporting this fix from pipewire, if this gets backported then MIPIs will all work without special treatment or explicitly using v4l2src)

This also plays well with checkbox timeout:

# normal termination
timeout(10)(take_photo)(elem, file_path=Path("/home/ubuntu/photo.jpeg"), delay_seconds=3)
# force stop
timeout(3)(take_photo)(elem, file_path=Path("/home/ubuntu/photo.jpeg"), delay_seconds=10)

@tomli380576 tomli380576 marked this pull request as draft February 20, 2025 06:21
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

Attention: Patch coverage is 93.08176% with 11 lines in your changes missing coverage. Please review.

Project coverage is 49.81%. Comparing base (c52cf57) to head (0c5d90c).
Report is 133 commits behind head on main.

Files with missing lines Patch % Lines
...ckbox-support/checkbox_support/camera_pipelines.py 93.08% 6 Missing and 5 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1741      +/-   ##
==========================================
+ Coverage   49.26%   49.81%   +0.55%     
==========================================
  Files         373      377       +4     
  Lines       40434    40931     +497     
  Branches     6830     6930     +100     
==========================================
+ Hits        19921    20391     +470     
- Misses      19785    19793       +8     
- Partials      728      747      +19     
Flag Coverage Δ
checkbox-support 64.69% <93.08%> (+2.71%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@tomli380576 tomli380576 marked this pull request as ready for review February 27, 2025 05:23
@fernando79513 fernando79513 self-assigned this Mar 7, 2025
@tomli380576 tomli380576 marked this pull request as draft March 23, 2025 14:27
@tomli380576 tomli380576 marked this pull request as ready for review March 23, 2025 14:27
@tomli380576 tomli380576 marked this pull request as draft March 28, 2025 06:48
@tomli380576 tomli380576 marked this pull request as ready for review March 28, 2025 07:16
@tomli380576 tomli380576 marked this pull request as draft May 13, 2025 14:30
@tomli380576 tomli380576 marked this pull request as ready for review May 13, 2025 14:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants