Ejemplo n.º 1
0
    frame_interface* synthetic_source::allocate_composite_frame(std::vector<frame_holder> holders)
    {
        frame_additional_data d {};

        auto req_size = 0;
        for (auto&& f : holders)
            req_size += get_embeded_frames_size(f.frame);

        auto res = _actual_source.alloc_frame(RS2_EXTENSION_COMPOSITE_FRAME, req_size * sizeof(rs2_frame*), d, true);
        if (!res) return nullptr;

        auto cf = static_cast<composite_frame*>(res);

        auto frames = cf->get_frames();
        for (auto&& f : holders)
            copy_frames(std::move(f), frames);
        frames -= req_size;

        auto releaser = [frames, req_size]()
        {
            for (auto i = 0; i < req_size; i++)
            {
                frames[i]->release();
                frames[i] = nullptr;
            }
        };
        frame_continuation release_frames(releaser, nullptr);
        cf->attach_continuation(std::move(release_frames));
        cf->set_stream(cf->first()->get_stream());

        return res;
    }
Ejemplo n.º 2
0
/*
 * Function: frame_enqueue()
 *
 * Description:
 *  Enqueue a frame into the frame cache queue.
 *
 * Input:
 *  paddr - The physical address of the frame to enqueue
 */
static inline void
frame_enqueue(uintptr_t paddr) {
  /* If our cache is full, release some frames */
  if (frame_cache_full()) {
    release_frames();
  }

  frame_cache[frame_cache_ed] = paddr;
  frame_cache_ed = (frame_cache_ed + 1) % FRAME_CACHE_SIZE;
}