Skip to content

Commit

Permalink
confirmed on Came1USB2
Browse files Browse the repository at this point in the history
  • Loading branch information
Fixstars-momoko committed Dec 5, 2023
2 parents ddbabce + 61cbc88 commit 633d3bd
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 19 deletions.
6 changes: 6 additions & 0 deletions src/bb/image-io/rt_common.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@
#include <opencv2/imgproc.hpp>
#endif

#include "log.h"

#include "httplib.h"
#include "zip_file.hpp"

Expand Down Expand Up @@ -52,13 +54,15 @@ class DynamicModule {
#endif

DynamicModule(const std::string &module_name, bool essential) {
ion::log::debug("Load module : Trying to load {}", module_name);
if (module_name == "") {
handle_ = nullptr;
return;
}

#ifdef _WIN32
auto file_name = module_name + ".dll";
ion::log::debug("Load module : Looking for {}", file_name);
handle_ = LoadLibraryA(file_name.c_str());

if (handle_ != nullptr){
Expand All @@ -67,10 +71,12 @@ class DynamicModule {
}

file_name = "lib" + file_name;
ion::log::debug("Load module : Looking for {}", file_name);
handle_ = LoadLibraryA(file_name.c_str());

#else
auto file_name = "lib" + module_name + ".so";
ion::log::debug("Load module : Looking for {}", file_name);
handle_ = dlopen(file_name.c_str(), RTLD_NOW);
#endif

Expand Down
38 changes: 19 additions & 19 deletions src/bb/image-io/rt_u3v.h
Original file line number Diff line number Diff line change
Expand Up @@ -619,26 +619,26 @@ class U3V {
int internal_count = 0;
int max_internal_count = 1000;

while (frame_cnt_ >= latest_cnt) {
arv_stream_push_buffer(devices_[cameN_idx_].stream_, bufs[cameN_idx_]);
auto timeout2_us = 30 * 1000 * 1000;
bufs[cameN_idx_] = arv_stream_timeout_pop_buffer (devices_[cameN_idx_].stream_, timeout2_us);
if (bufs[cameN_idx_] == nullptr){
log::error("pop_buffer(L8) failed due to timeout ({}s)", timeout2_us*1e-6f);
throw ::std::runtime_error("buffer is null");
}
devices_[cameN_idx_].frame_count_ = is_gendc_
? static_cast<uint32_t>(get_frame_count_from_genDC_descriptor(bufs[cameN_idx_], devices_[cameN_idx_]))
: static_cast<uint32_t>(arv_buffer_get_timestamp(bufs[cameN_idx_]) & 0x00000000FFFFFFFF);
cameN_idx_ == 0 ?
log::trace("All-Popped Frames (USB0, USB1)=({:20}, {:20}) [skipped for realtime display]", devices_[cameN_idx_].frame_count_, "") :
log::trace("All-Popped Frames (USB0, USB1)=({:20}, {:20}) [skipped for realtime display]", "", devices_[cameN_idx_].frame_count_);
latest_cnt = devices_[cameN_idx_].frame_count_;
if (internal_count++ > max_internal_count){
log::error("pop_buffer(L10) The sequential invalid buffer is more than {}; Stop the pipeline.", max_internal_count);
throw ::std::runtime_error("Invalid framecount");
while (frame_cnt_ >= latest_cnt) {
arv_stream_push_buffer(devices_[cameN_idx_].stream_, bufs[cameN_idx_]);
auto timeout2_us = 30 * 1000 * 1000;
bufs[cameN_idx_] = arv_stream_timeout_pop_buffer (devices_[cameN_idx_].stream_, timeout2_us);
if (bufs[cameN_idx_] == nullptr){
log::error("pop_buffer(L8) failed due to timeout ({}s)", timeout2_us*1e-6f);
throw ::std::runtime_error("buffer is null");
}
devices_[cameN_idx_].frame_count_ = is_gendc_
? static_cast<uint32_t>(get_frame_count_from_genDC_descriptor(bufs[cameN_idx_], devices_[cameN_idx_]))
: static_cast<uint32_t>(arv_buffer_get_timestamp(bufs[cameN_idx_]) & 0x00000000FFFFFFFF);
cameN_idx_ == 0 ?
log::trace("All-Popped Frames (USB0, USB1)=({:20}, {:20})", devices_[cameN_idx_].frame_count_, "") :
log::trace("All-Popped Frames (USB0, USB1)=({:20}, {:20})", "", devices_[cameN_idx_].frame_count_);
latest_cnt = devices_[cameN_idx_].frame_count_;
if (internal_count++ > max_internal_count){
log::error("pop_buffer(L10) The sequential invalid buffer is more than {}; Stop the pipeline.", max_internal_count);
throw ::std::runtime_error("Invalid framecount");
}
}
}

frame_cnt_ = latest_cnt;
::memcpy(outs[0], arv_buffer_get_data(bufs[cameN_idx_], nullptr), devices_[cameN_idx_].u3v_payload_size_);
Expand Down

0 comments on commit 633d3bd

Please sign in to comment.