5 #include "../backend.h" 20 _context(context), _action_dispatcher(10)
24 throw std::runtime_error(
"can't find UVC streaming interface of device: " + context.
usb_device->get_info().id);
45 if (!fp || payload_len < 2)
48 uint8_t header_len = fp->pixels[0];
49 uint8_t header_info = fp->pixels[1];
51 size_t data_len = payload_len - header_len;
53 if (header_info & 0x40)
58 if (header_len > payload_len)
60 LOG_ERROR(
"bogus packet: actual_len=" << payload_len <<
", header_len=" << header_len);
65 LOG_DEBUG(
"Passing packet to user CB with size " << (data_len + header_len));
67 fp->pixels.data() + header_len , fp->pixels.data() };
77 std::vector<backend_frame *>
frames;
82 frames.push_back(ptr);
85 for (
auto ptr : frames) {
99 _watchdog = std::make_shared<watchdog>([
this]()
121 auto al =
r->get_actual_length();
124 if(al > 0L && ((al ==
r->get_buffer().data()[0] +
_context.
control->dwMaxVideoFrameSize) || is_compressed ))
131 memcpy(
f->pixels.data(),
r->get_buffer().data(),
r->get_buffer().size());
138 LOG_ERROR(
"failed to submit UVC request, error: " << sts);
143 for(
auto&&
r : _requests)
169 throw std::runtime_error(
"failed to submit UVC request while start streaming");
240 auto duration = std::chrono::duration_cast<std::chrono::milliseconds>(
end -
start).
count();
241 if(duration > timeout_ms)
static const textual_icon lock
std::unique_ptr< backend_frame, cleanup_ptr > backend_frame_ptr
bool val_in_range(const T &val, const std::initializer_list< T > &list)
rs_usb_messenger messenger
bool dequeue(T *item, unsigned int timeout_ms)
std::shared_ptr< uvc_stream_ctrl_t > control
backend_frames_archive * owner
LOG_INFO("Log message using LOG_INFO()")
void cleanup_frame(backend_frame *ptr)
const int DEQUEUE_MILLISECONDS_TIMEOUT
void invoke(T item, bool is_blocking=false)
typename::boost::move_detail::remove_reference< T >::type && move(T &&t) BOOST_NOEXCEPT
const int UVC_PAYLOAD_MAX_HEADER_LENGTH
const int ENDPOINT_RESET_MILLISECONDS_TIMEOUT
void invoke_and_wait(T item, std::function< bool()> exit_condition, bool is_blocking=false)