Skip to content
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

Fixed frameset handling on viewer #8856

Merged
merged 2 commits into from
Apr 19, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
68 changes: 37 additions & 31 deletions common/viewer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1345,49 +1345,55 @@ namespace rs2
size_t index = 0;
while (ppf.resulting_queue.poll_for_frame(&f) && ++index < ppf.resulting_queue_max_size)
{
if (streams.find(f.get_profile().unique_id()) != streams.end() ||
streams.find(streams_origin[f.get_profile().unique_id()]) != streams.end())
last_frames[f.get_profile().unique_id()] = f;
// Open the frameset and save the frames on last_frames
// if one of the streams is missing we will use the last frame arrived
if (f.is<rs2::frameset>())
{
for (auto frame : f.as<rs2::frameset>())
{
if (streams.find(frame.get_profile().unique_id()) != streams.end() ||
streams.find(streams_origin[frame.get_profile().unique_id()]) != streams.end())
last_frames[frame.get_profile().unique_id()] = frame;
}
}
else
{
if (streams.find(f.get_profile().unique_id()) != streams.end() ||
streams.find(streams_origin[f.get_profile().unique_id()]) != streams.end())
last_frames[f.get_profile().unique_id()] = f;
}
}

for(auto&& f : last_frames)
not_model->output.update_dashboards(f.second);

for(auto&& frame : last_frames)
for( auto && frame : last_frames )
{
auto f = frame.second;
frameset frames;
if ((frames = f.as<frameset>()))
maloel marked this conversation as resolved.
Show resolved Hide resolved
{
for (auto&& frame : frames)
{
if (frame.is<points>() && !paused) // find and store the 3d points frame for later use
{
p = frame.as<points>();
continue;
}

if (frame.is<pose_frame>()) // Aggregate the trajectory in pause mode to make the path consistent
{
auto dev = streams[frame.get_profile().unique_id()].dev;
if (dev)
{
dev->tm2.update_model_trajectory(frame.as<pose_frame>(), !paused);
}
}

auto texture = upload_frame(std::move(frame));
if( f.is< points >()
&& ! paused ) // find and store the 3d points frame for later use
{
p = f.as< points >();
continue;
}

if ((selected_tex_source_uid == -1 && frame.get_profile().format() == RS2_FORMAT_Z16) ||
(frame.get_profile().format() != RS2_FORMAT_ANY && is_3d_texture_source(frame)))
{
texture_frame = texture;
}
if( f.is< pose_frame >() ) // Aggregate the trajectory in pause mode to make the
// path consistent
{
auto dev = streams[f.get_profile().unique_id()].dev;
if( dev )
{
dev->tm2.update_model_trajectory( f.as< pose_frame >(), ! paused );
}
}
else if (!p)

auto texture = upload_frame( std::move( f ) );

if( ( selected_tex_source_uid == -1 && f.get_profile().format() == RS2_FORMAT_Z16 )
|| ( f.get_profile().format() != RS2_FORMAT_ANY && is_3d_texture_source( f ) ) )
{
upload_frame(std::move(f));
texture_frame = texture;
}
}
}
Expand Down