Send both frame rate and refresh rate in description

This commit is contained in:
Patrick Nicolas
2026-04-27 10:26:58 +02:00
parent 775022d065
commit e21b1adf1d
6 changed files with 15 additions and 12 deletions
+1 -1
View File
@@ -140,7 +140,7 @@ decoder::decoder(
// latency mode
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_WIDTH, width);
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_HEIGHT, height);
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_OPERATING_RATE, std::ceil(description.fps));
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_OPERATING_RATE, std::ceil(description.frame_rate));
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_PRIORITY, 0);
media_codec.reset(AMediaCodec_createDecoderByType(mime(description.codec[stream_index])));
+2 -2
View File
@@ -1165,7 +1165,7 @@ void scenes::stream::exit()
void scenes::stream::setup(const to_headset::video_stream_description & description)
{
session.set_refresh_rate(description.fps);
session.set_refresh_rate(description.refresh_rate);
std::unique_lock lock(decoder_mutex);
if (video_stream_description == description)
@@ -1189,7 +1189,7 @@ void scenes::stream::setup_reprojection_swapchain(uint32_t swapchain_width, uint
assert(swapchain_width);
assert(swapchain_height);
device.waitIdle();
session.set_refresh_rate(video_stream_description->fps);
session.set_refresh_rate(video_stream_description->refresh_rate);
auto views = system.view_configuration_views(viewconfig);
+2 -2
View File
@@ -111,10 +111,10 @@ void scenes::stream::operator()(to_headset::video_stream_description && desc)
void scenes::stream::operator()(to_headset::refresh_rate_change && rate)
{
session.set_refresh_rate(rate.fps);
session.set_refresh_rate(rate.hz);
std::shared_lock lock(decoder_mutex);
if (video_stream_description)
video_stream_description->fps = rate.fps;
video_stream_description->refresh_rate = rate.hz;
}
void scenes::stream::operator()(to_headset::stream_tab_change && tab)
+3 -2
View File
@@ -678,7 +678,8 @@ struct video_stream_description
uint16_t width;
uint16_t height;
std::array<video_codec, 3> codec; // left, right, alpha
float fps;
float frame_rate;
float refresh_rate;
bool operator==(const video_stream_description &) const = default;
};
@@ -765,7 +766,7 @@ struct feature_control
struct refresh_rate_change
{
float fps;
float hz;
};
struct stream_tab_change
+3 -2
View File
@@ -550,7 +550,7 @@ xrt_result_t compositor::request_display_refresh_rate(float hz)
try
{
requested_refresh_rate = hz;
session.send_control(to_headset::refresh_rate_change{.fps = hz});
session.send_control(to_headset::refresh_rate_change{.hz = hz});
}
catch (std::exception & e)
{
@@ -641,8 +641,9 @@ void compositor::send_video_stream_description()
to_headset::video_stream_description desc{
.width = uint16_t(images[0].image.info().extent.width),
.height = uint16_t(images[0].image.info().extent.height),
.fps = settings[0].fps,
.frame_rate = settings[0].fps,
};
get_display_refresh_rate(&desc.refresh_rate);
static_assert(std::tuple_size_v<decltype(settings)> == std::tuple_size_v<decltype(desc.codec)>);
std::ranges::transform(settings, desc.codec.begin(), &encoder_settings::codec);
session.send_control(std::move(desc));
+4 -3
View File
@@ -401,9 +401,10 @@ void wivrn_session::resume_session()
if (target_fps != current_fps)
{
auto s = settings.lock();
(*this)(from_headset::refresh_rate_changed{
.from = current_fps,
.to = target_fps,
.from = current_fps * s->fps_divider,
.to = target_fps * s->fps_divider,
});
}
}
@@ -964,7 +965,7 @@ struct refresh_rate_adjuster
if (requested != last)
{
U_LOG_I("requesting refresh rate: %.0f (app rate %.1f)", requested, app_rate);
cnx.send_control(to_headset::refresh_rate_change{.fps = requested});
cnx.send_control(to_headset::refresh_rate_change{.hz = requested});
last = requested;
}
}