feat(downstream): add cvmmap downstream runtime implementation
This commit introduces the full downstream runtime implementation needed to ingest, transform, and publish streams. It preserves the original upstream request boundary by packaging the entire cvmmap-streamer module (build config, public API, protocol and IPC glue, and simulator/tester entrypoints) in one coherent core unit. Keeping this group isolated enables reviewers to validate runtime behavior and correctness without mixing test evidence or process documentation changes. Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
#pragma once
|
||||
|
||||
#include "cvmmap_streamer/config/runtime_config.hpp"
|
||||
|
||||
#include <cstdint>
|
||||
#include <expected>
|
||||
#include <span>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
|
||||
#include <sys/socket.h>
|
||||
|
||||
namespace cvmmap_streamer::protocol {
|
||||
|
||||
struct RtpPublisherStats {
|
||||
std::uint64_t access_units{0};
|
||||
std::uint64_t access_unit_bytes{0};
|
||||
std::uint64_t packets_sent{0};
|
||||
std::uint64_t packets_dropped{0};
|
||||
std::uint64_t bytes_sent{0};
|
||||
std::uint64_t send_errors{0};
|
||||
};
|
||||
|
||||
class UdpRtpPublisher {
|
||||
public:
|
||||
UdpRtpPublisher() = default;
|
||||
~UdpRtpPublisher();
|
||||
|
||||
UdpRtpPublisher(const UdpRtpPublisher &) = delete;
|
||||
UdpRtpPublisher &operator=(const UdpRtpPublisher &) = delete;
|
||||
|
||||
UdpRtpPublisher(UdpRtpPublisher &&other) noexcept;
|
||||
UdpRtpPublisher &operator=(UdpRtpPublisher &&other) noexcept;
|
||||
|
||||
[[nodiscard]]
|
||||
static std::expected<UdpRtpPublisher, std::string> create(const RuntimeConfig &config);
|
||||
|
||||
void publish_access_unit(std::span<const std::uint8_t> access_unit, std::uint64_t pts_ns);
|
||||
|
||||
[[nodiscard]]
|
||||
const RtpPublisherStats &stats() const;
|
||||
|
||||
[[nodiscard]]
|
||||
std::string_view sdp_path() const;
|
||||
|
||||
[[nodiscard]]
|
||||
std::string_view destination() const;
|
||||
|
||||
void log_metrics() const;
|
||||
|
||||
private:
|
||||
int socket_fd_{-1};
|
||||
std::string destination_host_{};
|
||||
std::string destination_ip_{};
|
||||
std::uint16_t destination_port_{0};
|
||||
std::uint8_t payload_type_{96};
|
||||
CodecType codec_{CodecType::H264};
|
||||
std::uint16_t sequence_{0};
|
||||
std::uint32_t ssrc_{0};
|
||||
std::string sdp_path_{};
|
||||
RtpPublisherStats stats_{};
|
||||
|
||||
sockaddr_storage endpoint_addr_{};
|
||||
socklen_t endpoint_addr_len_{0};
|
||||
};
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user