breadcast/breadcast-caststream-sys/vendor/openscreen/platform/api/trace_event.cc
Breadway 8c745d18e0
Some checks failed
dev release / build (push) Failing after 12s
Implement Cast Streaming mirroring, DLNA casting, daemon+GUI, and breadd integration
Builds out the full v1 scope: a vendored+patched openscreen subset for
low-latency Cast Streaming (Mirroring receiver 0F5096E8) alongside the
existing Cast V2/HLS and new DLNA/AVTransport casting paths, breadcastd's
Idle/Casting state machine with a private IPC socket, the breadcast GTK4
popup as a thin IPC client, and bread.cast.*/bread.command.cast.* breadd
integration (device discovery, start/stop, mirroring lifecycle events).
Also adds bakery/systemd/Forgejo CI packaging.

Validated end-to-end against a real Chromecast/Google TV: negotiated
Cast Streaming session, live pipeline playback, and daemon+GUI click-to-cast/
stop through the actual popup.
2026-08-03 09:07:21 +08:00

61 lines
1.8 KiB
C++

// Copyright 2022 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#include "platform/api/trace_event.h"
#include <sstream>
namespace openscreen {
TraceEvent::TraceEvent(TraceCategory category,
Clock::time_point start_time,
const char* name,
const char* file_name,
uint32_t line_number)
: category(category),
start_time(start_time),
name(name),
file_name(file_name),
line_number(line_number) {}
TraceEvent::TraceEvent() = default;
TraceEvent::TraceEvent(TraceEvent&&) noexcept = default;
TraceEvent::TraceEvent(const TraceEvent&) = default;
TraceEvent& TraceEvent::operator=(TraceEvent&&) = default;
TraceEvent& TraceEvent::operator=(const TraceEvent&) = default;
TraceEvent::~TraceEvent() = default;
std::string TraceEvent::ToString() const {
std::ostringstream oss;
oss << ids << " " << openscreen::ToString(category) << "::" << name << " <"
<< file_name << ":" << line_number << ">";
// We only support two arguments in total.
if (!arguments.empty()) {
oss << " { " << arguments[0].first << ": " << arguments[0].second;
if (arguments.size() > 1) {
oss << ", " << arguments[1].first << ": " << arguments[1].second;
}
oss << " }";
}
return oss.str();
}
void TraceEvent::TruncateStrings() {
for (auto& argument : arguments) {
if (argument.second.size() > kMaxStringLength) {
argument.second.resize(kMaxStringLength);
// Populate last three digits with ellipses to indicate that
// we truncated this string.
argument.second.replace(kMaxStringLength - 3, 3, "...");
}
}
}
std::ostream& operator<<(std::ostream& out, const TraceEvent& event) {
return out << event.ToString();
}
} // namespace openscreen