]> git.sesse.net Git - nageru/blobdiff - disk_space_estimator.cpp
Allow symlinked frame files. Useful for testing.
[nageru] / disk_space_estimator.cpp
index 50460f9893446d78b429bc6916a832d98e095a5b..69de4d5578d24877664ff45ddb70b5972911e3fe 100644 (file)
@@ -1,18 +1,18 @@
 #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) {
@@ -24,13 +24,7 @@ void DiskSpaceEstimator::report_write(const std::string &filename, uint64_t 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) {