Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache camera stream info to speed up future config generations #11614

Merged
merged 3 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
fix
  • Loading branch information
NickM-27 committed May 29, 2024
commit 6b031d33bfcadfe133376032635b05112eb6bd77
2 changes: 1 addition & 1 deletion frigate/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -1418,7 +1418,7 @@ def runtime_config(self, plus_api: PlusApi = None) -> FrigateConfig:
if need_detect_dimensions or need_record_fourcc:
stream_info = {"width": 0, "height": 0, "fourcc": None}
try:
stream_info = stream_info_retriever.get_resolution(input.path)
stream_info = stream_info_retriever.get_stream_info(input.path)
except Exception:
logger.warn(
f"Error detecting stream parameters automatically for {input.path} Applying default values."
Expand Down
4 changes: 2 additions & 2 deletions frigate/util/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -202,10 +202,10 @@ class StreamInfoRetriever:
def __init__(self) -> None:
self.stream_cache: dict[str, tuple[int, int]] = {}

def get_resolution(self, path: str) -> str:
def get_stream_info(self, path: str) -> str:
if path in self.stream_cache:
return self.stream_cache[path]

info = asyncio.run(get_video_properties(input.path))
info = asyncio.run(get_video_properties(path))
self.stream_cache[path] = info
return info
Loading