Send both frame rate and refresh rate in description
This commit is contained in:
@@ -140,7 +140,7 @@ decoder::decoder(
|
|||||||
// latency mode
|
// latency mode
|
||||||
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_WIDTH, width);
|
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_WIDTH, width);
|
||||||
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_HEIGHT, height);
|
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);
|
AMediaFormat_setInt32(format.get(), AMEDIAFORMAT_KEY_PRIORITY, 0);
|
||||||
|
|
||||||
media_codec.reset(AMediaCodec_createDecoderByType(mime(description.codec[stream_index])));
|
media_codec.reset(AMediaCodec_createDecoderByType(mime(description.codec[stream_index])));
|
||||||
|
|||||||
@@ -1165,7 +1165,7 @@ void scenes::stream::exit()
|
|||||||
|
|
||||||
void scenes::stream::setup(const to_headset::video_stream_description & description)
|
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);
|
std::unique_lock lock(decoder_mutex);
|
||||||
if (video_stream_description == description)
|
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_width);
|
||||||
assert(swapchain_height);
|
assert(swapchain_height);
|
||||||
device.waitIdle();
|
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);
|
auto views = system.view_configuration_views(viewconfig);
|
||||||
|
|
||||||
|
|||||||
@@ -111,10 +111,10 @@ void scenes::stream::operator()(to_headset::video_stream_description && desc)
|
|||||||
|
|
||||||
void scenes::stream::operator()(to_headset::refresh_rate_change && rate)
|
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);
|
std::shared_lock lock(decoder_mutex);
|
||||||
if (video_stream_description)
|
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)
|
void scenes::stream::operator()(to_headset::stream_tab_change && tab)
|
||||||
|
|||||||
@@ -678,7 +678,8 @@ struct video_stream_description
|
|||||||
uint16_t width;
|
uint16_t width;
|
||||||
uint16_t height;
|
uint16_t height;
|
||||||
std::array<video_codec, 3> codec; // left, right, alpha
|
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;
|
bool operator==(const video_stream_description &) const = default;
|
||||||
};
|
};
|
||||||
@@ -765,7 +766,7 @@ struct feature_control
|
|||||||
|
|
||||||
struct refresh_rate_change
|
struct refresh_rate_change
|
||||||
{
|
{
|
||||||
float fps;
|
float hz;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct stream_tab_change
|
struct stream_tab_change
|
||||||
|
|||||||
@@ -550,7 +550,7 @@ xrt_result_t compositor::request_display_refresh_rate(float hz)
|
|||||||
try
|
try
|
||||||
{
|
{
|
||||||
requested_refresh_rate = hz;
|
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)
|
catch (std::exception & e)
|
||||||
{
|
{
|
||||||
@@ -641,8 +641,9 @@ void compositor::send_video_stream_description()
|
|||||||
to_headset::video_stream_description desc{
|
to_headset::video_stream_description desc{
|
||||||
.width = uint16_t(images[0].image.info().extent.width),
|
.width = uint16_t(images[0].image.info().extent.width),
|
||||||
.height = uint16_t(images[0].image.info().extent.height),
|
.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)>);
|
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);
|
std::ranges::transform(settings, desc.codec.begin(), &encoder_settings::codec);
|
||||||
session.send_control(std::move(desc));
|
session.send_control(std::move(desc));
|
||||||
|
|||||||
@@ -401,9 +401,10 @@ void wivrn_session::resume_session()
|
|||||||
|
|
||||||
if (target_fps != current_fps)
|
if (target_fps != current_fps)
|
||||||
{
|
{
|
||||||
|
auto s = settings.lock();
|
||||||
(*this)(from_headset::refresh_rate_changed{
|
(*this)(from_headset::refresh_rate_changed{
|
||||||
.from = current_fps,
|
.from = current_fps * s->fps_divider,
|
||||||
.to = target_fps,
|
.to = target_fps * s->fps_divider,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -964,7 +965,7 @@ struct refresh_rate_adjuster
|
|||||||
if (requested != last)
|
if (requested != last)
|
||||||
{
|
{
|
||||||
U_LOG_I("requesting refresh rate: %.0f (app rate %.1f)", requested, app_rate);
|
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;
|
last = requested;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user