refactor(protocol): switch runtime to protocol wire codec paths
Point the build and dummy runtime producer at the canonical protocol module so runtime ownership matches the refactored directory structure. - compile src/protocol/wire_codec.cpp - update frame source to include and use protocol::wire_codec - remove remaining sim/wire usage from runtime code Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
+1
-1
@@ -36,7 +36,7 @@ add_library(cvmmap_streamer_common STATIC
|
|||||||
src/core/frame_source.cpp
|
src/core/frame_source.cpp
|
||||||
src/core/ingest_runtime.cpp
|
src/core/ingest_runtime.cpp
|
||||||
src/ipc/contracts.cpp
|
src/ipc/contracts.cpp
|
||||||
src/sim/wire.cpp
|
src/protocol/wire_codec.cpp
|
||||||
lib/cvmmap-client-cpp/app_cvmmap_client.cpp
|
lib/cvmmap-client-cpp/app_cvmmap_client.cpp
|
||||||
lib/cvmmap-client-cpp/app_cvmmap_parser.cpp
|
lib/cvmmap-client-cpp/app_cvmmap_parser.cpp
|
||||||
src/metrics/latency_tracker.cpp
|
src/metrics/latency_tracker.cpp
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "cvmmap_streamer/core/frame_source.hpp"
|
#include "cvmmap_streamer/core/frame_source.hpp"
|
||||||
|
|
||||||
#include "cvmmap_streamer/ipc/contracts.hpp"
|
#include "cvmmap_streamer/ipc/contracts.hpp"
|
||||||
#include "cvmmap_streamer/sim/wire.hpp"
|
#include "cvmmap_streamer/protocol/wire_codec.hpp"
|
||||||
|
|
||||||
#include <app/cvmmap/cvmmap_client.hpp>
|
#include <app/cvmmap/cvmmap_client.hpp>
|
||||||
|
|
||||||
@@ -32,6 +32,7 @@ namespace cvmmap_streamer::core {
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
namespace ipc = cvmmap_streamer::ipc;
|
namespace ipc = cvmmap_streamer::ipc;
|
||||||
|
namespace wire_codec = cvmmap_streamer::protocol::wire_codec;
|
||||||
|
|
||||||
[[nodiscard]]
|
[[nodiscard]]
|
||||||
std::string resolve_client_target(const RuntimeConfig &config) {
|
std::string resolve_client_target(const RuntimeConfig &config) {
|
||||||
@@ -328,10 +329,10 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void send_status(
|
void send_status(
|
||||||
std::array<std::uint8_t, sim::kModuleStatusMessageBytes> &buffer,
|
std::array<std::uint8_t, wire_codec::kModuleStatusMessageBytes> &buffer,
|
||||||
ipc::ModuleStatus status,
|
ipc::ModuleStatus status,
|
||||||
std::uint32_t frame_count) const {
|
std::uint32_t frame_count) const {
|
||||||
sim::write_module_status_message(buffer, config_.dummy.label, status);
|
wire_codec::write_module_status_message(buffer, config_.dummy.label, status);
|
||||||
publisher_->send(zmq::buffer(buffer), zmq::send_flags::none);
|
publisher_->send(zmq::buffer(buffer), zmq::send_flags::none);
|
||||||
if (status == ipc::ModuleStatus::Offline || status == ipc::ModuleStatus::Online) {
|
if (status == ipc::ModuleStatus::Offline || status == ipc::ModuleStatus::Online) {
|
||||||
spdlog::info("dummy source status={} frame_count={}", static_cast<std::int32_t>(status), frame_count);
|
spdlog::info("dummy source status={} frame_count={}", static_cast<std::int32_t>(status), frame_count);
|
||||||
@@ -339,8 +340,8 @@ private:
|
|||||||
}
|
}
|
||||||
|
|
||||||
void run_producer_loop() const {
|
void run_producer_loop() const {
|
||||||
std::array<std::uint8_t, sim::kSyncMessageBytes> sync_buffer{};
|
std::array<std::uint8_t, wire_codec::kSyncMessageBytes> sync_buffer{};
|
||||||
std::array<std::uint8_t, sim::kModuleStatusMessageBytes> status_buffer{};
|
std::array<std::uint8_t, wire_codec::kModuleStatusMessageBytes> status_buffer{};
|
||||||
|
|
||||||
const auto payload_bytes = static_cast<std::size_t>(config_.dummy.width) *
|
const auto payload_bytes = static_cast<std::size_t>(config_.dummy.width) *
|
||||||
static_cast<std::size_t>(config_.dummy.height) *
|
static_cast<std::size_t>(config_.dummy.height) *
|
||||||
@@ -362,9 +363,9 @@ private:
|
|||||||
while (!stop_requested_.load(std::memory_order_relaxed)) {
|
while (!stop_requested_.load(std::memory_order_relaxed)) {
|
||||||
frame_count += 1;
|
frame_count += 1;
|
||||||
auto payload = shm_->payload(payload_bytes);
|
auto payload = shm_->payload(payload_bytes);
|
||||||
sim::write_deterministic_payload(payload, frame_count, config_.dummy.width, config_.dummy.height, config_.dummy.channels);
|
wire_codec::write_deterministic_payload(payload, frame_count, config_.dummy.width, config_.dummy.height, config_.dummy.channels);
|
||||||
|
|
||||||
sim::write_frame_metadata(
|
wire_codec::write_frame_metadata(
|
||||||
shm_->metadata(),
|
shm_->metadata(),
|
||||||
ipc::FrameInfo{
|
ipc::FrameInfo{
|
||||||
.width = config_.dummy.width,
|
.width = config_.dummy.width,
|
||||||
@@ -376,7 +377,7 @@ private:
|
|||||||
frame_count,
|
frame_count,
|
||||||
timestamp_ns);
|
timestamp_ns);
|
||||||
|
|
||||||
sim::write_sync_message(sync_buffer, config_.dummy.label, frame_count, timestamp_ns);
|
wire_codec::write_sync_message(sync_buffer, config_.dummy.label, frame_count, timestamp_ns);
|
||||||
publisher_->send(zmq::buffer(sync_buffer), zmq::send_flags::none);
|
publisher_->send(zmq::buffer(sync_buffer), zmq::send_flags::none);
|
||||||
|
|
||||||
if (config_.dummy.emit_reset_at && *config_.dummy.emit_reset_at == frame_count) {
|
if (config_.dummy.emit_reset_at && *config_.dummy.emit_reset_at == frame_count) {
|
||||||
|
|||||||
Reference in New Issue
Block a user