Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@john-
Copy link

@john- john- commented Jun 29, 2025

This pull request intends to address a timing issue when concatenating fragments. It results in an error discussed here.

I have incorrectly diagnosed the problem a couple times but I think I have it figured out now.

To reproduce

  1. User has create_event_clip enabled
  2. A recording completes before segments applicable to that recording have been written
  3. ffmpeg is called for that recording however there are no segments available so it errors out

In theory this would also result in not taking into account all segments if a segment ends during the recording and another is started while recording is in progress.

This case will not result in an error. However, there will be one segment missing from the concatenation.

The fix

The in the PR involved adding a delay in the thread that concatenates the segments. This allows time for in progress segments to be written to disk.

Reason for this solution and alternate approach

It seems like a delay similar to this is used at another locaation in the code.

An alternate way may be able to have logic that blocks the concatenation until the in progress segment is written to disk.

As this is for the clip recording feature it is OK to have this delay before the recording is fully complete.

Test cases

There should be test cases that address the cases I am aware of. One can comment out the delay in concatenation to see the impact on the test cases.

The return value to _concatenate_fragments was added to aid in unit testing.

@netlify
Copy link

netlify bot commented Jun 29, 2025

Deploy Preview for viseron canceled.

Name Link
🔨 Latest commit e2c8d46
🔍 Latest deploy log https://app.netlify.com/projects/viseron/deploys/6861c5d8f26a1900083d0684

@roflcoopter roflcoopter self-requested a review June 30, 2025 09:22
Copy link
Owner

@roflcoopter roflcoopter left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, thank you!

@roflcoopter roflcoopter merged commit 0064201 into roflcoopter:dev Jun 30, 2025
18 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants