Implement Cast Streaming mirroring, DLNA casting, daemon+GUI, and breadd integration
Some checks failed
dev release / build (push) Failing after 12s
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:
parent
887c29002f
commit
8c745d18e0
283 changed files with 36788 additions and 0 deletions
62
breadcast-caststream-sys/vendor/openscreen/util/crypto/openssl_util.cc
vendored
Normal file
62
breadcast-caststream-sys/vendor/openscreen/util/crypto/openssl_util.cc
vendored
Normal file
|
|
@ -0,0 +1,62 @@
|
|||
// 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.
|
||||
|
||||
#include "util/crypto/openssl_util.h"
|
||||
|
||||
#include <openssl/crypto.h>
|
||||
#include <openssl/err.h>
|
||||
#include <stddef.h>
|
||||
#include <stdint.h>
|
||||
|
||||
#include <sstream>
|
||||
#include <string>
|
||||
#include <string_view>
|
||||
#include <utility>
|
||||
|
||||
#include "util/osp_logging.h"
|
||||
|
||||
namespace openscreen {
|
||||
|
||||
namespace {
|
||||
|
||||
// Callback routine for OpenSSL to print error messages. `str` is a
|
||||
// nullptr-terminated string of length `len` containing diagnostic information
|
||||
// such as the library, function and reason for the error, the file and line
|
||||
// where the error originated, plus potentially any context-specific
|
||||
// information about the error. `context` contains a pointer to user-supplied
|
||||
// data, which is currently unused.
|
||||
// If this callback returns a value <= 0, OpenSSL will stop processing the
|
||||
// error queue and return, otherwise it will continue calling this function
|
||||
// until all errors have been removed from the queue.
|
||||
int OpenSSLErrorCallback(const char* str, size_t len, void* context) {
|
||||
OSP_DVLOG << "\t" << std::string_view(str, len);
|
||||
return 1;
|
||||
}
|
||||
|
||||
} // namespace
|
||||
|
||||
void EnsureOpenSSLInit() {
|
||||
// LOCAL PATCH (breadcast): upstream calls OPENSSL_init_ssl() here, but
|
||||
// this vendored subset never touches libssl (no TLS -- see
|
||||
// ../../../PATCHES.md), so this just does the general libcrypto init
|
||||
// instead. Safe to call repeatedly; OpenSSL 3.x makes this optional
|
||||
// anyway, but frame_crypto.cc's key setup wants it done up front.
|
||||
OPENSSL_init_crypto(0, nullptr);
|
||||
}
|
||||
|
||||
void ClearOpenSSLERRStack(const Location& location) {
|
||||
if (OSP_DCHECK_IS_ON()) {
|
||||
uint32_t error_num = ERR_peek_error();
|
||||
if (error_num == 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
OSP_DVLOG << "OpenSSL ERR_get_error stack from " << location;
|
||||
ERR_print_errors_cb(&OpenSSLErrorCallback, nullptr);
|
||||
} else {
|
||||
ERR_clear_error();
|
||||
}
|
||||
}
|
||||
|
||||
} // namespace openscreen
|
||||
61
breadcast-caststream-sys/vendor/openscreen/util/crypto/openssl_util.h
vendored
Normal file
61
breadcast-caststream-sys/vendor/openscreen/util/crypto/openssl_util.h
vendored
Normal file
|
|
@ -0,0 +1,61 @@
|
|||
// 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 UTIL_CRYPTO_OPENSSL_UTIL_H_
|
||||
#define UTIL_CRYPTO_OPENSSL_UTIL_H_
|
||||
|
||||
#include <stddef.h>
|
||||
|
||||
#include <cstring>
|
||||
|
||||
#include "platform/base/error.h"
|
||||
#include "platform/base/location.h"
|
||||
|
||||
// LOCAL PATCH (breadcast): dropped SSLErrorCodeToError()/GetSSLError(),
|
||||
// which format an SSL_get_error() result and reference BoringSSL's
|
||||
// SSL_error_description() (not part of system OpenSSL's public API). Unused
|
||||
// here -- the TLS CASTV2 control channel is handled by the existing
|
||||
// rust_cast-based Rust code, not this vendored openscreen subset, which only
|
||||
// needs the general ERR_*/AES pieces. See vendor/openscreen/PATCHES.md.
|
||||
|
||||
namespace openscreen {
|
||||
// Initialize OpenSSL if it isn't already initialized. This must be called
|
||||
// before any other OpenSSL functions though it is safe and cheap to call this
|
||||
// multiple times.
|
||||
// This function is thread-safe, and OpenSSL will only ever be initialized once.
|
||||
// OpenSSL will be properly shut down on program exit.
|
||||
// Multiple sequential calls to EnsureOpenSSLInit or EnsureOpenSSLCleanup are
|
||||
// ignored by OpenSSL itself.
|
||||
void EnsureOpenSSLInit();
|
||||
|
||||
// Drains the OpenSSL ERR_get_error stack. On a debug build the error codes
|
||||
// are send to VLOG(1), on a release build they are disregarded. In most
|
||||
// cases you should pass CURRENT_LOCATION as the `location`.
|
||||
void ClearOpenSSLERRStack(const Location& location);
|
||||
|
||||
// Place an instance of this class on the call stack to automatically clear
|
||||
// the OpenSSL error stack on function exit.
|
||||
class OpenSSLErrStackTracer {
|
||||
public:
|
||||
// Pass CURRENT_LOCATION as `location`, to help track the source of OpenSSL
|
||||
// error messages. Note any diagnostic emitted will be tagged with the
|
||||
// location of the constructor call as it's not possible to trace a
|
||||
// destructor's callsite.
|
||||
explicit OpenSSLErrStackTracer(const Location& location)
|
||||
: location_(location) {
|
||||
EnsureOpenSSLInit();
|
||||
}
|
||||
OpenSSLErrStackTracer(const OpenSSLErrStackTracer&) = delete;
|
||||
OpenSSLErrStackTracer(OpenSSLErrStackTracer&&) noexcept = delete;
|
||||
OpenSSLErrStackTracer& operator=(const OpenSSLErrStackTracer&) = delete;
|
||||
OpenSSLErrStackTracer& operator=(OpenSSLErrStackTracer&&) = delete;
|
||||
~OpenSSLErrStackTracer() { ClearOpenSSLERRStack(location_); }
|
||||
|
||||
private:
|
||||
const Location location_;
|
||||
};
|
||||
|
||||
} // namespace openscreen
|
||||
|
||||
#endif // UTIL_CRYPTO_OPENSSL_UTIL_H_
|
||||
23
breadcast-caststream-sys/vendor/openscreen/util/crypto/random_bytes.cc
vendored
Normal file
23
breadcast-caststream-sys/vendor/openscreen/util/crypto/random_bytes.cc
vendored
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright 2020 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#include "util/crypto/random_bytes.h"
|
||||
|
||||
#include "openssl/rand.h"
|
||||
#include "util/osp_logging.h"
|
||||
|
||||
namespace openscreen {
|
||||
|
||||
std::array<uint8_t, 16> GenerateRandomBytes16() {
|
||||
std::array<uint8_t, 16> result;
|
||||
GenerateRandomBytes(result);
|
||||
return result;
|
||||
}
|
||||
|
||||
void GenerateRandomBytes(ByteBuffer out) {
|
||||
// Working cryptography is mandatory for our library to run.
|
||||
OSP_CHECK(RAND_bytes(out.data(), out.size()) == 1);
|
||||
}
|
||||
|
||||
} // namespace openscreen
|
||||
20
breadcast-caststream-sys/vendor/openscreen/util/crypto/random_bytes.h
vendored
Normal file
20
breadcast-caststream-sys/vendor/openscreen/util/crypto/random_bytes.h
vendored
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
// Copyright 2020 The Chromium Authors
|
||||
// Use of this source code is governed by a BSD-style license that can be
|
||||
// found in the LICENSE file.
|
||||
|
||||
#ifndef UTIL_CRYPTO_RANDOM_BYTES_H_
|
||||
#define UTIL_CRYPTO_RANDOM_BYTES_H_
|
||||
|
||||
#include <array>
|
||||
#include <cstdint>
|
||||
|
||||
#include "platform/base/span.h"
|
||||
|
||||
namespace openscreen {
|
||||
|
||||
std::array<uint8_t, 16> GenerateRandomBytes16();
|
||||
void GenerateRandomBytes(ByteBuffer out);
|
||||
|
||||
} // namespace openscreen
|
||||
|
||||
#endif // UTIL_CRYPTO_RANDOM_BYTES_H_
|
||||
Loading…
Add table
Add a link
Reference in a new issue