diff --git a/nixos/tests/mediamtx.nix b/nixos/tests/mediamtx.nix index 7f7d40d3e12a..a815efccfdfa 100644 --- a/nixos/tests/mediamtx.nix +++ b/nixos/tests/mediamtx.nix @@ -1,5 +1,8 @@ { pkgs, lib, ... }: +let + rtmpUrl = "rtmp://localhost:1935/test"; +in { name = "mediamtx"; meta.maintainers = with lib.maintainers; [ fpletz ]; @@ -23,8 +26,8 @@ DynamicUser = true; Restart = "on-failure"; RestartSec = "1s"; - TimeoutStartSec = "10s"; - ExecStart = "${lib.getBin pkgs.ffmpeg-headless}/bin/ffmpeg -re -f lavfi -i smptebars=size=800x600:rate=10 -c libx264 -f flv rtmp://localhost:1935/test"; + TimeoutStartSec = "30s"; + ExecStart = "${lib.getBin pkgs.ffmpeg-headless}/bin/ffmpeg -re -f lavfi -i smptebars=size=800x600:rate=10 -c libx264 -f flv ${rtmpUrl}"; }; }; @@ -33,12 +36,13 @@ after = [ "rtmp-publish.service" ]; bindsTo = [ "rtmp-publish.service" ]; wantedBy = [ "multi-user.target" ]; + unitConfig.StartLimitIntervalSec = 0; serviceConfig = { DynamicUser = true; Restart = "on-failure"; RestartSec = "1s"; - TimeoutStartSec = "10s"; - ExecStart = "${lib.getBin pkgs.ffmpeg-headless}/bin/ffmpeg -y -re -i rtmp://localhost:1935/test -f flv /dev/null"; + TimeoutStartSec = "30s"; + ExecStart = "${lib.getBin pkgs.ffmpeg-headless}/bin/ffmpeg -y -re -i ${rtmpUrl} -f flv /dev/null"; }; }; }; @@ -48,11 +52,11 @@ start_all() machine.wait_for_unit("mediamtx.service") + machine.wait_for_unit("rtmp-publish.service") - machine.sleep(10) + machine.wait_until_succeeds("curl http://localhost:9998/metrics | grep '^rtmp_conns.*state=\"publish\".*1$'") + machine.wait_for_unit("rtmp-receive.service") - machine.wait_for_open_port(9998) - machine.succeed("curl http://localhost:9998/metrics | grep '^rtmp_conns.*state=\"publish\".*1$'") - machine.succeed("curl http://localhost:9998/metrics | grep '^rtmp_conns.*state=\"read\".*1$'") + machine.wait_until_succeeds("curl http://localhost:9998/metrics | grep '^rtmp_conns.*state=\"read\".*1$'") ''; } diff --git a/pkgs/by-name/me/mediamtx/package.nix b/pkgs/by-name/me/mediamtx/package.nix index 5bd4506f7f75..ad98797bcc45 100644 --- a/pkgs/by-name/me/mediamtx/package.nix +++ b/pkgs/by-name/me/mediamtx/package.nix @@ -8,23 +8,23 @@ let hlsJs = fetchurl { - url = "https://cdn.jsdelivr.net/npm/hls.js@v1.5.20/dist/hls.min.js"; - hash = "sha256-0BbBIwSW7lnz9bAcFszkzAG1odPTV63sIAyQixMevkk="; + url = "https://cdn.jsdelivr.net/npm/hls.js@v1.6.2/dist/hls.min.js"; + hash = "sha256-5lAT3DQ1tVo0tSV6fmWDWSbB9NVyCduomoENNQX08UM="; }; in buildGoModule (finalAttrs: { pname = "mediamtx"; # check for hls.js version updates in internal/servers/hls/hlsjsdownloader/VERSION - version = "1.12.2"; + version = "1.12.3"; src = fetchFromGitHub { owner = "bluenviron"; repo = "mediamtx"; tag = "v${finalAttrs.version}"; - hash = "sha256-O3Iu9gvCiAVuoJw77MWPyCfuJVcw0E8YWcJBiJq+/Ms="; + hash = "sha256-2eTvRWFSR6sXnUJJPKvzQhSqbg1Unh8QuxmyixAw8Cc="; }; - vendorHash = "sha256-0927IeFIC2rhApPVs5ZIvS3yoDN8Km3tHgrRXnP/wBc="; + vendorHash = "sha256-CdJS+RebJA6CpOo6YLlTpCXzE0eWSAnWzVXECvgMBvc="; postPatch = '' cp ${hlsJs} internal/servers/hls/hls.min.js