Skip to content

Commit e2a0c3d

Browse files
craftitReactAIdavisking
authored
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 2a5760a. * Fix second instance. * Static not needed when inline. --------- Co-authored-by: Charles Galambos <[email protected]> Co-authored-by: Davis E. King <[email protected]>
1 parent 775ac07 commit e2a0c3d

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

dlib/dnn/utilities.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ namespace dlib
7373

7474
// ----------------------------------------------------------------------------------------
7575

76-
static size_t tensor_index(
76+
inline size_t tensor_index(
7777
const tensor& t,
7878
const long sample,
7979
const long k,

dlib/media/ffmpeg_demuxer.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ namespace dlib
876876
frame decoded;
877877
frame src;
878878
src.f = std::move(avframe); //make sure you move it back when you're done
879-
src.timestamp = system_clock::time_point{nanoseconds{timestamp_ns}};
879+
src.timestamp = system_clock::time_point{duration_cast<system_clock::duration>(nanoseconds{timestamp_ns})};
880880

881881
if (src.is_image())
882882
{

dlib/media/ffmpeg_utils.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -818,9 +818,9 @@ namespace dlib
818818

819819
dst.f = std::move(tmp);
820820
dst.f->pts = tracked_samples;
821-
dst.timestamp = system_clock::time_point{nanoseconds{av_rescale_q(tracked_samples,
821+
dst.timestamp = system_clock::time_point{system_clock::duration{av_rescale_q(tracked_samples,
822822
{1, dst_sample_rate},
823-
{nanoseconds::period::num, nanoseconds::period::den})}};
823+
{system_clock::duration::period::num, system_clock::duration::period::den})}};
824824
tracked_samples += dst.nsamples();
825825

826826
}
@@ -907,10 +907,10 @@ namespace dlib
907907

908908
while (av_audio_fifo_size(fifo.get()) >= frame_size)
909909
{
910-
const system_clock::time_point timestamp{nanoseconds{av_rescale_q(
910+
const system_clock::time_point timestamp{system_clock::duration{av_rescale_q(
911911
sample_count,
912912
{1, in.sample_rate()},
913-
{nanoseconds::period::num, nanoseconds::period::den})}};
913+
{system_clock::duration::period::num, system_clock::duration::period::den})}};
914914

915915
frame out(in.sample_rate(), frame_size, in.layout(), in.samplefmt(), timestamp);
916916

0 commit comments

Comments
 (0)