Implement Cast Streaming mirroring, DLNA casting, daemon+GUI, and breadd integration
Some checks failed
dev release / build (push) Failing after 12s

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.
This commit is contained in:
Breadway 2026-08-03 09:07:21 +08:00
parent 887c29002f
commit 8c745d18e0
283 changed files with 36788 additions and 0 deletions

View file

@ -0,0 +1,73 @@
// Copyright 2019 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
#ifndef CAST_STREAMING_IMPL_NTP_TIME_H_
#define CAST_STREAMING_IMPL_NTP_TIME_H_
#include <stdint.h>
#include "platform/api/time.h"
namespace openscreen::cast {
// NTP timestamps are 64-bit timestamps that consist of two 32-bit parts: 1) The
// number of seconds since 1 January 1900; and 2) The fraction of the second,
// where 0 maps to 0x00000000 and each unit increment represents another 2^-32
// seconds.
//
// Note that it is part of the design of NTP for the seconds part to roll around
// on 7 February 2036.
using NtpTimestamp = uint64_t;
// NTP fixed-point time math: Declare two std::chrono::duration types with the
// bit-width necessary to reliably perform all conversions to/from NTP format.
using NtpSeconds = std::chrono::duration<int64_t, std::chrono::seconds::period>;
using NtpFraction =
std::chrono::duration<int64_t, std::ratio<1, INT64_C(0x100000000)>>;
constexpr NtpSeconds NtpSecondsPart(NtpTimestamp timestamp) {
return NtpSeconds(timestamp >> 32);
}
constexpr NtpFraction NtpFractionPart(NtpTimestamp timestamp) {
return NtpFraction(timestamp & 0xffffffff);
}
constexpr NtpTimestamp AssembleNtpTimestamp(NtpSeconds seconds,
NtpFraction fraction) {
return (static_cast<uint64_t>(seconds.count()) << 32) |
static_cast<uint32_t>(fraction.count());
}
// Converts between Clock::time_points and NtpTimestamps. The class is
// instantiated with the current Clock time and the current wall clock time, and
// these are used to determine a fixed origin reference point for all
// conversions. Thus, to avoid introducing unintended timing-related behaviors,
// only one NtpTimeConverter instance should be used for converting all the NTP
// timestamps in the same streaming session.
class NtpTimeConverter {
public:
NtpTimeConverter(
Clock::time_point now,
std::chrono::seconds since_unix_epoch = GetWallTimeSinceUnixEpoch());
~NtpTimeConverter();
NtpTimestamp ToNtpTimestamp(Clock::time_point time_point) const;
Clock::time_point ToLocalTime(NtpTimestamp timestamp) const;
private:
// The time point on the platform clock's timeline that corresponds to
// approximately the same time point on the NTP timeline. Note that it is
// acceptable for the granularity of the NTP seconds value to be whole seconds
// here: Both a Cast Streaming Sender and Receiver will assume their clocks
// can be off (with respect to each other) by even a large amount; and all
// that matters is that time ticks forward at a reasonable pace from some
// initial point.
const Clock::time_point start_time_;
const NtpSeconds since_ntp_epoch_;
};
} // namespace openscreen::cast
#endif // CAST_STREAMING_IMPL_NTP_TIME_H_