skip encoding when session paused
this is already done by `offset_est.reset()` as a side-effect but it's implemented formally in case that breaks by future changes.
This commit is contained in:
@@ -523,7 +523,7 @@ static VkResult comp_wivrn_present(struct comp_target * ct,
|
||||
.pWaitDstStageMask = &wait_stage,
|
||||
};
|
||||
|
||||
if (cn->c->base.layer_accum.layer_count == 0 or not cn->cnx.get_offset())
|
||||
if (cn->c->base.layer_accum.layer_count == 0 or not cn->cnx.get_offset() or cn->skip_encoding)
|
||||
{
|
||||
scoped_lock lock(vk->main_queue->mutex);
|
||||
cn->wivrn_bundle->queue.submit(submit_info);
|
||||
@@ -827,6 +827,17 @@ void wivrn_comp_target::reset_encoders()
|
||||
cnx.send_control(to_headset::video_stream_description{desc});
|
||||
}
|
||||
|
||||
void wivrn_comp_target::pause()
|
||||
{
|
||||
skip_encoding = true;
|
||||
}
|
||||
|
||||
void wivrn_comp_target::resume()
|
||||
{
|
||||
reset_encoders();
|
||||
skip_encoding = false;
|
||||
}
|
||||
|
||||
void wivrn_comp_target::set_bitrate(uint32_t bitrate_bps)
|
||||
{
|
||||
for (auto & encoder: encoders)
|
||||
|
||||
@@ -101,14 +101,18 @@ struct wivrn_comp_target : public comp_target
|
||||
std::optional<wivrn_foveation> foveation;
|
||||
|
||||
std::atomic<float> requested_refresh_rate;
|
||||
std::atomic<bool> skip_encoding;
|
||||
|
||||
wivrn_comp_target(wivrn::wivrn_session & cnx, struct comp_compositor * c);
|
||||
~wivrn_comp_target();
|
||||
|
||||
void on_feedback(const from_headset::feedback &, const clock_offset &);
|
||||
void reset_encoders();
|
||||
void set_bitrate(uint32_t bitrate_bps);
|
||||
|
||||
void pause();
|
||||
void resume();
|
||||
|
||||
void set_bitrate(uint32_t bitrate_bps);
|
||||
void set_refresh_rate(float);
|
||||
};
|
||||
|
||||
|
||||
@@ -417,9 +417,14 @@ void wivrn_session::pause_session()
|
||||
}
|
||||
|
||||
// pause session components
|
||||
worker_thread = std::jthread();
|
||||
|
||||
offset_est.reset();
|
||||
worker_thread = std::jthread();
|
||||
{
|
||||
std::shared_lock lock(comp_target_mutex);
|
||||
if (comp_target)
|
||||
comp_target->pause();
|
||||
}
|
||||
}
|
||||
|
||||
void wivrn_session::resume_session()
|
||||
@@ -449,7 +454,7 @@ void wivrn_session::resume_session()
|
||||
{
|
||||
std::shared_lock lock(comp_target_mutex);
|
||||
if (comp_target)
|
||||
comp_target->reset_encoders();
|
||||
comp_target->resume();
|
||||
}
|
||||
worker_thread = std::jthread([this](std::stop_token stop) { return run_worker(stop); });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user