Skip to content

Live view fails silently with stock go2rtc since media leases (0.48.x): "curl failed: No error" #979

Closed

Description

@BlackStump

Summary

Since the media-authority changes (PR #835, notably 8de25fa "Enforce camera audio authority and revoke established media leases") together with #822 (go2rtc API/RTSP pinned to loopback), LightNVR requires its own go2rtc fork. Running a stock go2rtc makes every proxied live-view request fail. Nothing in the UI or log says go2rtc is the wrong build. It took several hours to track down.

Setup

  • LightNVR 0.48.2 built from source (cross-compiled, LIGHTNVR_PROFILE=embedded), Hi3536DV100 (single Cortex-A7, 256 MB) running OpenIPC
  • go2rtc: upstream AlexxIT release 1.9.15 (7c05066, go2rtc_linux_arm) at [go2rtc] binary_path
  • 0.46.3 worked fine with that same go2rtc binary

Symptoms

  • Live view: HLS shows "go2rtc HLS stream failed", MSE shows "Cannot connect to camera source". Recording works.
  • The log only shows:
    [WARN] [go2rtcProxy] go2rtc proxy thread: curl failed: No error
    
  • go2rtc itself is healthy. Over an SSH tunnel to 127.0.0.1:1984/go2rtc/, the same streams play fine.
  • The same config on a NUC running the Docker image works, because it ships the fork.

Cause

src/web/go2rtc_proxy_thread.c sends X-LightNVR-Media-Lease and treats a successful response without X-LightNVR-Media-Policy: 1 as a failure (around line 308):

(ctx->media_lease[0] && ctx->http_code < 300 && !ctx->media_policy_ack)

Only the fork in the go2rtc submodule (internal/mediaauth) sends that header. Building the submodule and using it fixed live view immediately:

cd go2rtc
GOOS=linux GOARCH=arm GOARM=7 CGO_ENABLED=0 go build -trimpath -ldflags "-s -w" -o go2rtc .

Suggestions

  1. Log a specific error when the policy ack is missing, e.g. "go2rtc did not acknowledge the media policy — is binary_path pointing at LightNVR's go2rtc fork?"
  2. Check this once at startup (alongside the existing --version probe) and show it on the System/health page, rather than failing per request.
  3. Note in INSTALLATION.md (source and cross-compile sections) that the bundled go2rtc fork is required from 0.48, and how to build it.

Related performance note (low-end ARM)

With the fork in place it works, but each lease check is slow on this CPU:

[WARN] [HTTP] Slow API phase: path=/api/internal/media-lease phase=handler execution duration_ms=387
[WARN] [HTTP] Slow API phase: path=/api/internal/media-lease phase=handler execution duration_ms=650
[WARN] [go2rtcProxy] go2rtc proxy authorization took 355 ms for /go2rtc/api/frame.jpeg

WebRTC is fine (one check per session), but HLS/MSE issue many requests and suffer. Caching a validated lease per session or connection would help small devices a lot.

I use claude ai it would be beyond my skillset to not use claude ai

Activity

  1. matteius commented on Nov 19, 2026

    @matteius
    Contributor

    We have been packaging the fork of go2rtc for a while now, but that being said thank you for your report and I will make the improvements in the coming days.

  2. BlackStump commented on Nov 19, 2026

    @BlackStump
    Author

    Thanks Matteius — understood that the packages already ship the fork; I’m cross-compiling for a Hi3536DV100 (OpenIPC), which is how I ended up with stock go2rtc. Happy to test any changes on this hardware

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions