mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-10-15 03:02:49 +03:00
Accept codec sample rates in ffmpeg: go2rtc sources
The ffmpeg: parameter allowlist only accepted plain names for video, audio and hardware, so the documented HomeKit source with #audio=opus/16000 was rejected by PUT /go2rtc/streams, config/save and config/set. Names may now carry a numeric /rate suffix. A rate without a name is still rejected. All ffmpeg: sources in the docs pass the check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
ac0f39268c
commit
20962bb12d
@@ -418,6 +418,9 @@ class TestGo2rtcStreamAccess(BaseTestHttp):
|
||||
"ffmpeg:front_door#video=out.mp4",
|
||||
"ffmpeg:front_door#drawtext=x",
|
||||
"ffmpeg:front_door#width=1x",
|
||||
"ffmpeg:front_door#audio=/16000",
|
||||
"ffmpeg:front_door#audio=opus/",
|
||||
"ffmpeg:front_door#audio=opus/16000/1",
|
||||
"ffmpeg:'front_door'",
|
||||
" ffmpeg:#input=-re",
|
||||
):
|
||||
@@ -444,6 +447,8 @@ class TestGo2rtcStreamAccess(BaseTestHttp):
|
||||
"ffmpeg:front_door#audio=opus",
|
||||
"ffmpeg:front_door#video=h264#hardware=vaapi",
|
||||
"ffmpeg:front_door#video=h264#width=1280#rotate=-90",
|
||||
# documented HomeKit source
|
||||
"ffmpeg:front_door#video=h264#width=1280#height=720#audio=opus/16000",
|
||||
"ffmpeg:http://10.0.0.1/flv?port=1935&app=bcs#video=copy",
|
||||
):
|
||||
resp = client.put("/go2rtc/streams/legit", params={"src": src})
|
||||
|
||||
@@ -994,7 +994,8 @@ _GO2RTC_FFMPEG_NUMERIC_PARAMS = frozenset(
|
||||
{"width", "height", "rotate", "bitrate", "timeout"}
|
||||
)
|
||||
_GO2RTC_FFMPEG_FLAG_PARAMS = frozenset({"async"})
|
||||
_GO2RTC_FFMPEG_NAME_VALUE = re.compile(r"^[A-Za-z0-9_]*$")
|
||||
# a preset or codec name, optionally with a sample rate (e.g. opus/16000)
|
||||
_GO2RTC_FFMPEG_NAME_VALUE = re.compile(r"^([A-Za-z0-9_]*|[A-Za-z0-9_]+/[0-9]{1,6})$")
|
||||
_GO2RTC_FFMPEG_NUMERIC_VALUE = re.compile(r"^-?[0-9]+[kKmM]?$")
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user