精简
This commit is contained in:
+14
-14
@@ -90,10 +90,10 @@ nlohmann::json frame_policy_schema(const Policy& policy) {
|
||||
{"value", current.render_enabled}
|
||||
},
|
||||
{
|
||||
{"key", "video_enabled"}, {"label", "图集视频传输"}, {"editor", "boolean"},
|
||||
{"key", "pixel_delivery_enabled"}, {"label", "图集像素传输"}, {"editor", "boolean"},
|
||||
{"editable", true}, {"description", "控制完成帧是否进入页面级采样器;2D BGRA 与 3D RGBA 均保持原生格式。"},
|
||||
{"technical_description", "Authoritative tile publication switch for the shared gallery video."},
|
||||
{"value", current.video_enabled}
|
||||
{"technical_description", "Authoritative tile publication switch for the shared gallery pixel stream."},
|
||||
{"value", current.pixel_delivery_enabled}
|
||||
},
|
||||
{
|
||||
{"key", "pacing_mode"}, {"label", "服务端帧策略"}, {"editor", "select"},
|
||||
@@ -123,11 +123,11 @@ template <typename Policy>
|
||||
nlohmann::json write_frame_policy_prop(Policy& pacing,
|
||||
std::string_view key,
|
||||
const nlohmann::json& value) {
|
||||
if (key == "render_enabled" || key == "video_enabled") {
|
||||
if (key == "render_enabled" || key == "pixel_delivery_enabled") {
|
||||
if (!value.is_boolean()) return {{"success", false}, {"error", "frame policy switch requires a boolean"}};
|
||||
const bool target = value.get<bool>();
|
||||
if (key == "render_enabled") pacing.set_render_enabled(target);
|
||||
else pacing.set_video_enabled(target);
|
||||
else pacing.set_pixel_delivery_enabled(target);
|
||||
return {
|
||||
{"success", true}, {"component", "frame-analysis"}, {"key", key},
|
||||
{"value", target}
|
||||
@@ -198,7 +198,7 @@ nlohmann::json frame_policy_state_json(const Frame_Policy::State& state) {
|
||||
"configuration", {
|
||||
{"mode", pacing_mode_name(state.mode)},
|
||||
{"render_enabled", state.render_enabled},
|
||||
{"video_enabled", state.video_enabled},
|
||||
{"pixel_delivery_enabled", state.pixel_delivery_enabled},
|
||||
{"fixed_rate_fps", state.fixed_rate_fps}
|
||||
}
|
||||
},
|
||||
@@ -718,7 +718,7 @@ void Plot::Private::fail(std::exception_ptr failure) noexcept {
|
||||
Plot_Stream_Frame{
|
||||
nlohmann::json{
|
||||
{"kind", "plot_error"},
|
||||
{"protocol", "aethera.video.frame"},
|
||||
{"protocol", "aethera.plot.stream"},
|
||||
{"version", plot_stream_protocol_version},
|
||||
{"message", *description}
|
||||
}.dump(),
|
||||
@@ -1015,7 +1015,7 @@ void Plot::Private::render_frame(Plot_Render_Tick tick) {
|
||||
Managed_Frame* managed{};
|
||||
/*
|
||||
* 只有 rendering 槽受 Scene 不可重入门约束;consuming 槽表示上一帧
|
||||
* 已经完成 Plot 像素发布,外接 H264/WebRTC 仍可继续持有该物理帧的
|
||||
* 已经完成 Plot 像素发布,外接 Drogon 图库流仍可继续持有该物理帧的
|
||||
* 诊断生命周期。只要还有 available 槽,下一帧即可进入。
|
||||
*/
|
||||
for (std::size_t index = 0; index < frame_slots.size(); ++index) {
|
||||
@@ -1108,7 +1108,7 @@ void Plot::Private::render_frame(Plot_Render_Tick tick) {
|
||||
else {
|
||||
auto& frame_3d = std::get<std::unique_ptr<Frame_3D>>(managed->frame);
|
||||
frame_3d->begin(identity,
|
||||
pacing.video_enabled
|
||||
pacing.pixel_delivery_enabled
|
||||
? Frame_3D_Output::pixels
|
||||
: Frame_3D_Output::diagnostics,
|
||||
Frame_3D::native_pixel_format, request_source,
|
||||
@@ -1264,7 +1264,7 @@ void Plot::Private::publish_completed_frame(
|
||||
const auto image = (*frame_2d)->image();
|
||||
width = static_cast<std::uint32_t>(image.width);
|
||||
height = static_cast<std::uint32_t>(image.height);
|
||||
if (pacing.video_enabled) {
|
||||
if (pacing.pixel_delivery_enabled) {
|
||||
auto output = (*frame_2d)->output_pixels();
|
||||
pixel_storage = std::make_shared<const std::vector<std::byte>>(
|
||||
std::move(output.bytes));
|
||||
@@ -1278,7 +1278,7 @@ void Plot::Private::publish_completed_frame(
|
||||
const auto extent = frame_3d->extent();
|
||||
width = extent.width;
|
||||
height = extent.height;
|
||||
if (pacing.video_enabled && frame_3d->output() == Frame_3D_Output::pixels) pixel_storage = frame_3d->share_pixels();
|
||||
if (pacing.pixel_delivery_enabled && frame_3d->output() == Frame_3D_Output::pixels) pixel_storage = frame_3d->share_pixels();
|
||||
}
|
||||
auto pixels = std::make_shared<const Plot_Pixel_Frame>(Plot_Pixel_Frame{
|
||||
std::move(pixel_storage), pixel_layout, managed->presentation_time,
|
||||
@@ -1507,7 +1507,7 @@ Plot::Stream_Id Plot::subscribe(Stream_Handler handler) {
|
||||
Plot_Stream_Frame{
|
||||
nlohmann::json{
|
||||
{"kind", "plot_error"},
|
||||
{"protocol", "aethera.video.frame"},
|
||||
{"protocol", "aethera.plot.stream"},
|
||||
{"version", plot_stream_protocol_version},
|
||||
{"message", failure ? *failure : "Plot unavailable"}
|
||||
}.dump(),
|
||||
@@ -1714,7 +1714,7 @@ nlohmann::json Plot::diagnostics() const {
|
||||
const auto pixel_height = completed_height == 0
|
||||
? stream.height
|
||||
: completed_height;
|
||||
const std::size_t byte_length = pacing.video_enabled
|
||||
const std::size_t byte_length = pacing.pixel_delivery_enabled
|
||||
? static_cast<std::size_t>(pixel_width) * pixel_height * 4U
|
||||
: 0U;
|
||||
nlohmann::json output{
|
||||
@@ -1728,7 +1728,7 @@ nlohmann::json Plot::diagnostics() const {
|
||||
"generated_time_unix_ms",
|
||||
static_cast<double>(created_time_unix_ns) / 1'000'000.0
|
||||
},
|
||||
{"delivery", pacing.video_enabled ? "gallery-video" : "diagnostics"},
|
||||
{"delivery", pacing.pixel_delivery_enabled ? "gallery-pixels" : "diagnostics"},
|
||||
{"frame_rate_fps", frame_rate},
|
||||
{"dropped_sequence_count", dropped_sequences},
|
||||
{"window_capacity", diagnostic_window_capacity},
|
||||
|
||||
Reference in New Issue
Block a user