Skip to content

Commit

Permalink
Fix #1: Start new file if resolution changes
Browse files Browse the repository at this point in the history
  • Loading branch information
glenne committed May 16, 2024
1 parent 2d92c65 commit d63ec4f
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion native/recorder/src/FrameProcessor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,10 @@ void FrameProcessor::processFrames() {
int count = 0;
auto start = high_resolution_clock::now();
auto useEmbeddedTimestamp = true;
int lastXres = 0;
int lastYres = 0;
float lastFPS = 0;

while (running) {
std::unique_lock<std::mutex> lock(queueMutex);
frameAvailable.wait(lock,
Expand All @@ -85,8 +89,13 @@ void FrameProcessor::processFrames() {
auto now = high_resolution_clock::now();
auto elapsed = duration_cast<milliseconds>(now - start);
auto okToSplit = elapsed.count() > 1200;
auto propChange = lastXres != video_frame->xres ||
lastYres != video_frame->yres || lastFPS != fps;
lastXres = video_frame->xres;
lastYres = video_frame->yres;
lastFPS = fps;

if (count == 0 ||
if (propChange || count == 0 ||
(useEmbeddedTimestamp && video_frame->timestamp >= nextStartTime) ||
(okToSplit && splitRequested)) {
count++;
Expand Down

0 comments on commit d63ec4f

Please sign in to comment.