X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=shared%2Fdisk_space_estimator.cpp;h=5cdc264652415bbbe9f8a5a7be7de7d929432544;hb=948d715655a84b93d8292e64731ea3c32b45deb7;hp=da55ee1e46b5018a0f8e381752bf661e55c11cc1;hpb=db2997d7290315086635ec914137b80f855cee37;p=nageru diff --git a/shared/disk_space_estimator.cpp b/shared/disk_space_estimator.cpp index da55ee1..5cdc264 100644 --- a/shared/disk_space_estimator.cpp +++ b/shared/disk_space_estimator.cpp @@ -40,6 +40,10 @@ void DiskSpaceEstimator::report_append(const string &filename, uint64_t pts) void DiskSpaceEstimator::report_write_internal(const string &filename, off_t file_size, uint64_t pts) { + if (measure_points.empty()) { + first_pts_this_file = pts; + } + // Reject points that are out-of-order (happens with B-frames). if (!measure_points.empty() && pts <= measure_points.back().pts) { return; @@ -66,7 +70,7 @@ void DiskSpaceEstimator::report_write_internal(const string &filename, off_t fil // Only report every second, since updating the UI can be expensive. if (last_pts_reported == 0 || pts - last_pts_reported >= TIMEBASE) { - callback(free_bytes, seconds_left); + callback(free_bytes, seconds_left, double(pts - first_pts_this_file) / TIMEBASE); last_pts_reported = pts; } }