Conversation
278e398 to
5cff9e8
Compare
Changeset ✓This PR includes a changeset covering all affected packages:
|
3bc5485 to
7959b92
Compare
7959b92 to
1730dd2
Compare
| enum { | ||
| LK_ARGUS_OK = 0, | ||
| /* Invalid arguments crossed the FFI boundary (caller bug). */ | ||
| LK_ARGUS_ERR_INVALID_ARG = -1, |
There was a problem hiding this comment.
It makes sense for error-codes, but typically I don't see negative values used for enums like this (I'm not a C developer so maybe it's common there)
| #define LK_ARGUS_MAX_DMA_BUFS 16 | ||
|
|
||
| /* Status codes. 0 is success; negative values are errors. */ | ||
| enum { |
There was a problem hiding this comment.
enum class is a little more modern. This code looks like C though which doesn't have that, but the .cpp has lots of C++ in it, so a bit puzzled
| #if defined(__GNUC__) | ||
| __attribute__((format(printf, 2, 3))) | ||
| #endif | ||
| void lk_log(int32_t level, const char* fmt, ...) { |
There was a problem hiding this comment.
Do we actually need another logger vs. just a std::cout/cerr or fprintf? This one is simple enough, just clarifying
| // C shim around NVIDIA libargus for MIPI CSI camera capture on Jetson. | ||
| // See lk_argus.h for the ABI and the thread-safety contract. | ||
|
|
||
| #include "lk_argus.h" | ||
|
|
||
| #include <atomic> | ||
| #include <chrono> | ||
| #include <cstdarg> | ||
| #include <cstdio> | ||
| #include <cstring> | ||
| #include <mutex> | ||
| #include <thread> | ||
| #include <vector> |
There was a problem hiding this comment.
Says C shim but lots of C++ in here
| return LK_ARGUS_OK; | ||
| } | ||
|
|
||
| void lk_argus_session_destroy(LkArgusSession* s) { |
There was a problem hiding this comment.
From AI-pairing, take with grain of salt:
P1: lk_argus_session_destroy can delete s while another thread is blocked in lk_argus_frame_acquire; when acquireFrame returns, that function continues dereferencing s. This contradicts the documented “interrupts any pending acquire” shutdown behavior and is a use-after-free. Please add an in-flight-operation count plus condition variable (destroy sets interrupted, stops capture, then waits for acquire/copy operations to exit before freeing surfaces and s), or change the API contract to require callers to interrupt and join the acquisition thread before destruction.
94bd3e1 to
17fd029
Compare
17fd029 to
bc3d828
Compare
74429d0 to
77dbd74
Compare
6377b94 to
f633156
Compare
53180dd to
10b81c8
Compare
10b81c8 to
94dee1e
Compare
94dee1e to
cf2336f
Compare
cf2336f to
f7de04c
Compare
Add a
libargus-syscrate with bindings to the NVIDIA Jetson libargus camera API.Closes BOT-553