C++ example for mcap using RangedPlayback#861
C++ example for mcap using RangedPlayback#861ericmlujan wants to merge 5 commits intoeric/new-mcap-examplefrom
Conversation
Co-authored-by: Eric Lujan <ericmlujan@users.noreply.github.com>
There was a problem hiding this comment.
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; | ||
| } |
There was a problem hiding this comment.
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.
| time_tracker_->resume(); | ||
| } | ||
| status_ = foxglove::PlaybackStatus::Playing; | ||
| } |
There was a problem hiding this comment.
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.


Changelog
RangedPlaybackcapabilityDocs
Description
Add a C++ example using the RangedPlayback websocket capability to load and play back an mcap file. This example introduces an annotated
PlaybackSourcebase class, which others can pattern match to when implementing their own loaders for custom data formats.This PR ports #859.