Preserve phase when sampling 50 fps from a 60 fps camera
This commit is contained in:
1 parent
9bc3e7228c
commit
3db52c755c
3 files changed
+3
-3
No files matched your search
@@ -9,7 +9,7 @@ internal class CallVideoCadence(private val fps: Int) {
|
||||
lastPts = pts
|
||||
val scaled = pts * fps
|
||||
if (next >= 0 && scaled < next - 250_000) return false
|
||||
next = if (next < 0 || scaled - next > 250_000) scaled + 1_000_000 else next + 1_000_000
|
||||
next = if (next < 0 || scaled - next > 1_000_000) scaled + 1_000_000 else next + 1_000_000
|
||||
return true
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,7 @@ public:
|
||||
lastPts = pts;
|
||||
const int64_t scaled = pts * fps;
|
||||
if (next >= 0 && scaled < next - 250000) return false;
|
||||
next = next < 0 || scaled - next > 250000 ? scaled + 1000000 : next + 1000000;
|
||||
next = next < 0 || scaled - next > 1000000 ? scaled + 1000000 : next + 1000000;
|
||||
return true;
|
||||
}
|
||||
};
|
||||
@@ -118,7 +118,7 @@ private slots:
|
||||
qputenv("UTUN_CAMERA_TEST_LOG", path.toUtf8());
|
||||
}
|
||||
void captureCadence() {
|
||||
for (int input : {50, 100, 330}) for (int output : {30, 50, 60}) {
|
||||
for (int input : {50, 60, 100, 330}) for (int output : {30, 50, 60}) {
|
||||
if (output > input) continue;
|
||||
CallVideoCadence cadence(output); unsigned accepted = 0;
|
||||
for (int i = 0; i < input * 3; ++i) if (cadence.accept(1000000 + i * 1000000ll / input)) ++accepted;
|
||||
|
||||
Reference in new issue
Block a user