Skip to content

C++ example for mcap using RangedPlayback#861

Open
ericmlujan wants to merge 5 commits intoeric/new-mcap-examplefrom
eric/mcap-cpp-example
Open

C++ example for mcap using RangedPlayback#861
ericmlujan wants to merge 5 commits intoeric/new-mcap-examplefrom
eric/mcap-cpp-example

Conversation

@ericmlujan
Copy link
Contributor

Changelog

  • Add C++ example for using the RangedPlayback capability

Docs

  • This is an example.

Description

Add a C++ example using the RangedPlayback websocket capability to load and play back an mcap file. This example introduces an annotated PlaybackSource base class, which others can pattern match to when implementing their own loaders for custom data formats.

This PR ports #859.

Co-authored-by: Eric Lujan <ericmlujan@users.noreply.github.com>
Copy link

@cursor cursor bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 2 potential issues.

Bugbot Autofix is OFF. To automatically fix reported issues with Cloud Agents, enable Autofix in the Cursor dashboard.

time_tracker_->pause();
}
status_ = foxglove::PlaybackStatus::Paused;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete status check in pause function

Low Severity

The pause() function checks status_ == foxglove::PlaybackStatus::Ended but not whether status is already Paused. When called while already paused, it unnecessarily calls time_tracker_->pause() and redundantly sets status_. The condition should be status_ != foxglove::PlaybackStatus::Playing to properly short-circuit when not actively playing. This matches the semantic intent of "pause playback" which only applies when playback is happening.

Fix in Cursor Fix in Web

time_tracker_->resume();
}
status_ = foxglove::PlaybackStatus::Playing;
}
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Incomplete status check in play function

Low Severity

The play() function checks status_ == foxglove::PlaybackStatus::Ended but not whether status is already Playing. When called while already playing, it unnecessarily calls time_tracker_->resume() and redundantly sets status_. The condition should be status_ != foxglove::PlaybackStatus::Paused to properly short-circuit when not in a paused state. This is the same logical incompleteness as the pause() function.

Fix in Cursor Fix in Web

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

3 participants