#include "disk_space_estimator.h"
+#include "timebase.h"
+
+#include <memory>
#include <stdio.h>
#include <sys/stat.h>
#include <sys/statfs.h>
-#include <memory>
-
-#include "timebase.h"
DiskSpaceEstimator::DiskSpaceEstimator(DiskSpaceEstimator::callback_t callback)
: callback(callback)
{
}
-void DiskSpaceEstimator::report_write(const std::string &filename, uint64_t pts)
+void DiskSpaceEstimator::report_write(const std::string &filename, size_t bytes, uint64_t pts)
{
// Reject points that are out-of-order (happens with B-frames).
if (!measure_points.empty() && pts <= measure_points.back().pts) {
measure_points.pop_front();
}
- struct stat st;
- if (stat(filename.c_str(), &st) == -1) {
- perror(filename.c_str());
- return;
- }
-
- total_size += st.st_size;
+ total_size += bytes;
struct statfs fst;
if (statfs(filename.c_str(), &fst) == -1) {