Skip to content

Bound non-realtime RTSP frame buffering - #2959

Merged
PawelPeczek-Roboflow merged 3 commits into
mainfrom
fix/webrtc-rtsp-backpressure
Sep 11, 2026
Merged

Bound non-realtime RTSP frame buffering#2959
PawelPeczek-Roboflow merged 3 commits into
mainfrom
fix/webrtc-rtsp-backpressure

Conversation

@digaobarbosa

Copy link
Copy Markdown
Contributor

Description

Non-realtime RTSP processing can accumulate decoded frames faster than inference consumes them; bound its decoder queue to the existing 60-frame file-source capacity and pause decoding when full, preserving frame order and timestamps.

Type of change

  • Bug fix (non-breaking)

How has this change been tested?

  • Four focused tests pass: backpressure, ordered delivery with real PyAV decoding, cancellation, and sanitized failures.
  • Black and isort checks pass.
  • RTSP transport validation in staging pending.

Any specific deployment considerations

  • Inference server and WebRTC Modal worker.
  • The queue bound does not impose a new resolution policy; no general RTSP pixel limit exists to reuse.

@github-actions

github-actions Bot commented Sep 9, 2026

Copy link
Copy Markdown
Contributor

👋 Thanks for the pull request! Here is how automated Claude review works here, so you spend credits (and reviewer time) wisely.

🚦 This PR is marked Ready for review, so automated Claude review will run — and every pass spends real credits.

Warning

💸 The Claude reviewer bills in credits, not vibes

Automated review spins up a real agent that reads real code and spends real credits on every pass. It is glad to help — but it is not a rubber duck, a linter you poke in a loop, or a substitute for reading the contributing guide. Treat it like an expensive senior reviewer whose time you booked, and show up prepared.

Draft when unsure, Ready when you mean it:

  • 🌱 Not sure the PR is in good shape yet? Keep it (or set it back) as a draft — drafts pause review, so you can push and iterate without burning credits on a moving target.
  • 💪 Feel strong about the contents? Mark it Ready for review and the reviewer will take a look.

However you get there, arrive prepared:

  • 🧱 Bring a SOLID, thorough PR. Point your local agent at our skills/ to tune it to our guidelines first — or, if you are one of those fabled carbon-based contributors, read them yourself. A half-baked diff costs exactly the same to review as a finished one.
  • Resolve every comment before you re-request review. Re-requesting with threads still open means paying twice for the same conversation.
  • 🔁 Do not use CI review as an inner loop for a local agent. The reviewer is not a step-by-step debugger — do the unfolding locally and arrive with the answer, not the search.
  • 🙋 If something looks off, ask a human. One question to a maintainer is cheaper and faster than three rounds of agent re-review chasing a misread.

Reviews are not free. A draft costs nothing to review; a Ready PR is a promise that it is worth reviewing.

  • Prefer to skip automated review entirely? Add the skip-claude-review label.

@github-actions

Copy link
Copy Markdown
Contributor

🤖 Claude review started at commit a110046568f472b3e402e58811b5d172fc728b3d.

New commits are not auto-reviewed. Add the claude-review label to request a re-review — the label is consumed when the review starts, so just add it again next time.

@github-actions

Copy link
Copy Markdown
Contributor

Review summary

Skills: review-topic-concurrency-and-resource-safety, review-topic-test-hygiene (also considered review-topic-input-boundary-security for RTSP-URL credential handling).

No dedicated surface skill covers inference/core/interfaces/webrtc_worker/** — generic review plus topic skills only.

Scope: the new ThreadedRTSPTrack backpressure path is opt-in — webrtc_realtime_processing defaults to True (inference/core/env.py:841), so only requests that explicitly set it False with an rtsp_url reach the new code; realtime RTSP keeps the unchanged MediaPlayer.

Checked and clean:

  • Bounded 60-frame queue with a stop-flag-gated daemon decode thread; the with av.open(...) container is closed on every exit path (matches the sibling ThreadedVideoFileTrack convention).
  • Track stop() is reliably reached via video_processor.track.stop() in teardown and on connection failed/closed (webrtc.py:1385-1392); the player.video.stop() branch is realtime-only and correctly bypassed.
  • FFmpeg failures are collapsed to a generic "Failed to decode RTSP stream", so source-URL credentials cannot leak (mirrors _open_media_player).
  • PTS normalized to start at 0 with time_base preserved.
  • Tests exercise the real changed path (backpressure bound, ordered lossless delivery, cancellation unblocking a full queue, sanitized failures), including one with real PyAV decoding.

No medium+ blocking findings; no open clarification questions. Not a versioned subsystem (not inference-models or Execution Engine, no public HTTP/SDK/workflow-block contract), so no changelog entry is required.

Reviewed at HEAD: a110046

@github-actions

Copy link
Copy Markdown
Contributor

😎 PR passes the vibe-check and trust-me-bro verification.

@PawelPeczek-Roboflow
PawelPeczek-Roboflow merged commit 825c26d into main Sep 11, 2026
15 of 23 checks passed
@PawelPeczek-Roboflow
PawelPeczek-Roboflow deleted the fix/webrtc-rtsp-backpressure branch September 11, 2026 09:46
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