std::chrono::system_time on osx isn't in nanoseconds (#2795)

* Allow the scan parameters to be changed in a detector.

* Fix warning.

* Fix for clang on osx which std::chrono::system_time has a duration in microseconds not nanoseconds. ^

* Revert "Allow the scan parameters to be changed in a detector."

This reverts commit 2a5760aacf.

* Fix second instance.

* Static not needed when inline.

---------

Co-authored-by: Charles Galambos <charles@reactai.com>
Co-authored-by: Davis E. King <davis685@gmail.com>
This commit is contained in:
Charles Galambos 2023-05-09 15:39:05 +01:00 committed by GitHub
parent 775ac0799f
commit e2a0c3dfca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -73,7 +73,7 @@ namespace dlib
// ----------------------------------------------------------------------------------------
static size_t tensor_index(
inline size_t tensor_index(
const tensor& t,
const long sample,
const long k,

View File

@ -876,7 +876,7 @@ namespace dlib
frame decoded;
frame src;
src.f = std::move(avframe); //make sure you move it back when you're done
src.timestamp = system_clock::time_point{nanoseconds{timestamp_ns}};
src.timestamp = system_clock::time_point{duration_cast<system_clock::duration>(nanoseconds{timestamp_ns})};
if (src.is_image())
{

View File

@ -818,9 +818,9 @@ namespace dlib
dst.f = std::move(tmp);
dst.f->pts = tracked_samples;
dst.timestamp = system_clock::time_point{nanoseconds{av_rescale_q(tracked_samples,
dst.timestamp = system_clock::time_point{system_clock::duration{av_rescale_q(tracked_samples,
{1, dst_sample_rate},
{nanoseconds::period::num, nanoseconds::period::den})}};
{system_clock::duration::period::num, system_clock::duration::period::den})}};
tracked_samples += dst.nsamples();
}
@ -907,10 +907,10 @@ namespace dlib
while (av_audio_fifo_size(fifo.get()) >= frame_size)
{
const system_clock::time_point timestamp{nanoseconds{av_rescale_q(
const system_clock::time_point timestamp{system_clock::duration{av_rescale_q(
sample_count,
{1, in.sample_rate()},
{nanoseconds::period::num, nanoseconds::period::den})}};
{system_clock::duration::period::num, system_clock::duration::period::den})}};
frame out(in.sample_rate(), frame_size, in.layout(), in.samplefmt(), timestamp);