Merge remote-tracking branch 'upstream/master'
This commit is contained in:
@@ -76,7 +76,7 @@ public:
|
||||
std::string environment_model = "assets://ground.glb";
|
||||
|
||||
bool override_foveation_enable = false;
|
||||
float override_foveation_pitch = 10 * M_PI / 180;
|
||||
float override_foveation_pitch = -10 * M_PI / 180;
|
||||
float override_foveation_distance = 3;
|
||||
|
||||
bool high_power_mode;
|
||||
|
||||
@@ -257,7 +257,7 @@ void scenes::lobby::gui_connected(XrTime predicted_display_time)
|
||||
|
||||
if (next_scene->apps.draw_gui(*imgui_ctx, _("Disconnect")) == app_launcher::Cancel)
|
||||
{
|
||||
next_scene.reset();
|
||||
next_scene->exit();
|
||||
current_tab = tab::server_list;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -769,7 +769,7 @@ void scenes::stream::render(const XrFrameState & frame_state)
|
||||
last_display_time = frame_state.predictedDisplayTime;
|
||||
|
||||
std::shared_lock lock(decoder_mutex);
|
||||
if (not frame_state.shouldRender or (decoders[0].empty() and decoders[1].empty()))
|
||||
if (not frame_state.shouldRender or (decoders[0].empty() and decoders[1].empty()) or exiting)
|
||||
{
|
||||
// TODO: stop/restart video stream
|
||||
session.begin_frame();
|
||||
|
||||
@@ -218,6 +218,7 @@ public:
|
||||
return state_;
|
||||
}
|
||||
|
||||
void exit();
|
||||
bool alive() const
|
||||
{
|
||||
return !exiting;
|
||||
@@ -236,7 +237,6 @@ private:
|
||||
|
||||
void setup(const to_headset::video_stream_description &);
|
||||
void setup_reprojection_swapchain(uint32_t width, uint32_t height);
|
||||
void exit();
|
||||
|
||||
vk::raii::QueryPool query_pool = nullptr;
|
||||
bool query_pool_filled = false;
|
||||
|
||||
@@ -827,7 +827,7 @@ void scenes::stream::draw_gui(XrTime predicted_display_time, XrDuration predicte
|
||||
case gui_status::bitrate_settings:
|
||||
case gui_status::foveation_settings:
|
||||
imgui_ctx->layers()[0].orientation = head_position->second;
|
||||
imgui_ctx->layers()[0].position = head_position->first + M * glm::vec3{0, -override_foveation_distance * sin(override_foveation_pitch), -override_foveation_distance};
|
||||
imgui_ctx->layers()[0].position = head_position->first + M * glm::vec3{0, override_foveation_distance * sin(override_foveation_pitch), -override_foveation_distance};
|
||||
break;
|
||||
|
||||
case gui_status::hidden:
|
||||
|
||||
@@ -84,7 +84,7 @@ from_headset::tracking::pose locate_space(device_id device, XrSpace space, XrSpa
|
||||
.flags = cast_flags(location.locationFlags, velocity.velocityFlags),
|
||||
};
|
||||
spdlog::warn("xrLocateSpace failed for {}: {}", magic_enum::enum_name(device), xr::to_string(res));
|
||||
return {};
|
||||
return {.device = device};
|
||||
}
|
||||
|
||||
class locate_spaces_functor
|
||||
|
||||
Vendored
+19530
-19558
File diff suppressed because it is too large
Load Diff
@@ -61,6 +61,7 @@ struct pipewire_device : public audio_device
|
||||
std::atomic<size_t> mic_buffer_size_bytes;
|
||||
audio_data mic_current;
|
||||
std::unique_ptr<pw_stream, deleter> microphone;
|
||||
std::atomic<std::underlying_type_t<pw_stream_state>> mic_state{PW_STREAM_STATE_UNCONNECTED};
|
||||
pw_stream_events mic_events{
|
||||
.version = PW_VERSION_STREAM_EVENTS,
|
||||
.state_changed = &pipewire_device::mic_state_changed,
|
||||
@@ -78,6 +79,7 @@ struct pipewire_device : public audio_device
|
||||
static void mic_state_changed(void * self_v, pw_stream_state old, pw_stream_state state, const char * error);
|
||||
|
||||
void process_mic_data(wivrn::audio_data &&) override;
|
||||
void on_connect() override;
|
||||
|
||||
~pipewire_device()
|
||||
{
|
||||
@@ -342,6 +344,11 @@ void pipewire_device::mic_process(void * self_v)
|
||||
void pipewire_device::mic_state_changed(void * self_v, pw_stream_state old, pw_stream_state state, const char * error)
|
||||
{
|
||||
auto self = (pipewire_device *)self_v;
|
||||
self->mic_state = state;
|
||||
if (error)
|
||||
U_LOG_I("Microphone state changed from %s to %s (error: %s)", magic_enum::enum_name(old).data(), magic_enum::enum_name(state).data(), error);
|
||||
else
|
||||
U_LOG_I("Microphone state changed from %s to %s", magic_enum::enum_name(old).data(), magic_enum::enum_name(state).data());
|
||||
switch (state)
|
||||
{
|
||||
case PW_STREAM_STATE_ERROR:
|
||||
@@ -408,6 +415,10 @@ void pipewire_device::process_mic_data(wivrn::audio_data && sample)
|
||||
if (mic_samples.write(std::move(sample)))
|
||||
mic_buffer_size_bytes += size;
|
||||
}
|
||||
void pipewire_device::on_connect()
|
||||
{
|
||||
session.send_control(to_headset::feature_control{to_headset::feature_control::microphone, mic_state == PW_STREAM_STATE_STREAMING});
|
||||
}
|
||||
|
||||
std::unique_ptr<audio_device> create_pipewire_handle(
|
||||
const std::string & source_name,
|
||||
|
||||
@@ -404,6 +404,11 @@ struct pulse_device : public audio_device
|
||||
mic_buffer.push(std::move(mic_data));
|
||||
}
|
||||
|
||||
void on_connect() override
|
||||
{
|
||||
session.send_control(to_headset::feature_control{to_headset::feature_control::microphone, true});
|
||||
}
|
||||
|
||||
pulse_device(
|
||||
const std::string & source_name,
|
||||
const std::string & source_description,
|
||||
|
||||
@@ -36,6 +36,7 @@ struct audio_device
|
||||
virtual wivrn::to_headset::audio_stream_description description() const = 0;
|
||||
|
||||
virtual void process_mic_data(wivrn::audio_data &&) = 0;
|
||||
virtual void on_connect() = 0;
|
||||
|
||||
static std::unique_ptr<audio_device> create(
|
||||
const std::string & source_name,
|
||||
|
||||
@@ -40,7 +40,7 @@ class view_list
|
||||
{
|
||||
pose_list head_poses{device_id::HEAD};
|
||||
std::mutex mutex;
|
||||
XrViewStateFlags flags;
|
||||
XrViewStateFlags flags{};
|
||||
std::array<xrt_pose, 2> poses;
|
||||
std::array<xrt_fov, 2> fovs;
|
||||
|
||||
|
||||
@@ -146,7 +146,10 @@ wivrn::wivrn_session::wivrn_session(std::unique_ptr<wivrn_connection> connection
|
||||
get_info(),
|
||||
*this);
|
||||
if (audio_handle)
|
||||
{
|
||||
send_control(audio_handle->description());
|
||||
audio_handle->on_connect();
|
||||
}
|
||||
}
|
||||
catch (const std::exception & e)
|
||||
{
|
||||
@@ -1128,7 +1131,10 @@ void wivrn_session::reconnect(std::stop_token stop)
|
||||
comp_target->reset_encoders();
|
||||
}
|
||||
if (audio_handle)
|
||||
{
|
||||
send_control(audio_handle->description());
|
||||
audio_handle->on_connect();
|
||||
}
|
||||
|
||||
event.state.visible = true;
|
||||
event.state.focused = true;
|
||||
|
||||
@@ -292,10 +292,12 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
|
||||
output_buffer_size = align(output_buffer_size, video_caps.minBitstreamBufferSizeAlignment);
|
||||
item.output_buffer = buffer_allocation(
|
||||
vk.device,
|
||||
{.pNext = &video_profile_list,
|
||||
.size = output_buffer_size,
|
||||
.usage = vk::BufferUsageFlagBits::eVideoEncodeDstKHR | vk::BufferUsageFlagBits::eTransferSrc,
|
||||
.sharingMode = vk::SharingMode::eExclusive},
|
||||
{
|
||||
.pNext = &video_profile_list,
|
||||
.size = output_buffer_size,
|
||||
.usage = vk::BufferUsageFlagBits::eVideoEncodeDstKHR | vk::BufferUsageFlagBits::eTransferSrc,
|
||||
.sharingMode = vk::SharingMode::eExclusive,
|
||||
},
|
||||
{
|
||||
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT | VMA_ALLOCATION_CREATE_HOST_ACCESS_ALLOW_TRANSFER_INSTEAD_BIT,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
@@ -304,14 +306,17 @@ void wivrn::video_encoder_vulkan::init(const vk::VideoCapabilitiesKHR & video_ca
|
||||
|
||||
if (not(item.output_buffer.properties() & VK_MEMORY_PROPERTY_HOST_VISIBLE_BIT))
|
||||
{
|
||||
U_LOG_D("Using staging buffer for vulkan encode output");
|
||||
item.host_buffer = buffer_allocation(
|
||||
vk.device,
|
||||
{.size = output_buffer_size,
|
||||
.usage = vk::BufferUsageFlagBits::eTransferDst,
|
||||
.sharingMode = vk::SharingMode::eExclusive},
|
||||
{
|
||||
.size = output_buffer_size,
|
||||
.usage = vk::BufferUsageFlagBits::eTransferDst,
|
||||
.sharingMode = vk::SharingMode::eExclusive,
|
||||
},
|
||||
{
|
||||
.flags = VMA_ALLOCATION_CREATE_HOST_ACCESS_RANDOM_BIT,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO,
|
||||
.usage = VMA_MEMORY_USAGE_AUTO_PREFER_HOST,
|
||||
},
|
||||
"vulkan encode host buffer");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user