Hold the pacer lock a little less
This commit is contained in:
@@ -50,7 +50,6 @@ wivrn_pacer::wivrn_pacer(uint64_t frame_duration) :
|
|||||||
while (not t.stop_requested())
|
while (not t.stop_requested())
|
||||||
{
|
{
|
||||||
samples.clear();
|
samples.clear();
|
||||||
int64_t res = 0;
|
|
||||||
{
|
{
|
||||||
std::unique_lock lock(compute_mutex);
|
std::unique_lock lock(compute_mutex);
|
||||||
compute_cv.wait(lock);
|
compute_cv.wait(lock);
|
||||||
@@ -59,16 +58,14 @@ wivrn_pacer::wivrn_pacer(uint64_t frame_duration) :
|
|||||||
if (time.decoded > time.present)
|
if (time.decoded > time.present)
|
||||||
samples.push_back(time.decoded - time.present);
|
samples.push_back(time.decoded - time.present);
|
||||||
}
|
}
|
||||||
if (samples.empty())
|
|
||||||
continue;
|
|
||||||
auto it = samples.begin() + (samples.size() * 995) / 1000;
|
|
||||||
|
|
||||||
std::ranges::nth_element(samples, it);
|
|
||||||
res = *it + 1'000'000;
|
|
||||||
}
|
}
|
||||||
|
if (samples.empty())
|
||||||
|
continue;
|
||||||
|
auto it = samples.begin() + (samples.size() * 995) / 1000;
|
||||||
|
std::ranges::nth_element(samples, it);
|
||||||
|
|
||||||
std::unique_lock lock(mutex);
|
std::unique_lock lock(mutex);
|
||||||
safe_present_to_decoded_ns = res;
|
safe_present_to_decoded_ns = *it + 1'000'000;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
{}
|
{}
|
||||||
|
|||||||
Reference in New Issue
Block a user