Skip to content

WHIP / WHEP input required single track fixed.#1968

Open
JBRS307 wants to merge 3 commits into
masterfrom
@jbrs/whip-input-handle
Open

WHIP / WHEP input required single track fixed.#1968
JBRS307 wants to merge 3 commits into
masterfrom
@jbrs/whip-input-handle

Conversation

@JBRS307
Copy link
Copy Markdown
Contributor

@JBRS307 JBRS307 commented May 7, 2026

Fixes the issue where the video or audio only required track stalls the whole queue.

@JBRS307 JBRS307 self-assigned this May 7, 2026
@JBRS307 JBRS307 changed the title [wip] Whip input handling with droppable senders WHIP input required track handling by dropping senders. May 7, 2026
@JBRS307 JBRS307 requested a review from wkozyra95 May 7, 2026 14:21
Comment thread smelter-core/src/pipeline/webrtc/whip_input/create_new_session.rs Outdated
Comment thread smelter-core/src/pipeline/webrtc/whip_input/create_new_session.rs Outdated
@JBRS307 JBRS307 requested a review from Copilot May 8, 2026 07:57
@JBRS307 JBRS307 changed the title WHIP input required track handling by dropping senders. WHIP input required track handled. May 8, 2026
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR updates WHIP input track startup handling to avoid required inputs blocking indefinitely by ensuring unused queue track senders are eventually dropped, and adjusts the on-track handler to coordinate sender consumption safely across callbacks.

Changes:

  • Wrap WHIP video/audio QueueSender handles in Arc<Mutex<Option<_>>> and consume them via locking in handle_on_track.
  • Add a background timeout task that drops WHIP track senders if the corresponding on_track callback does not arrive within a fixed window.
  • Update the demo WHIP input registration example to set "required": true.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.

File Description
smelter-core/src/pipeline/webrtc/whip_input/on_track.rs Switch sender passing to Arc<Mutex<Option<...>>> and take senders under a lock when tracks start.
smelter-core/src/pipeline/webrtc/whip_input/create_new_session.rs Create mutex-protected senders and spawn a timeout task to drop unused senders.
integration-tests/examples/demo/inputs/whip.rs Mark demo WHIP input as required.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread smelter-core/src/pipeline/webrtc/whip_input/on_track.rs
Comment thread smelter-core/src/pipeline/webrtc/whip_input/on_track.rs
Comment on lines +101 to +105
tokio::spawn(async move {
tokio::time::sleep(Duration::from_secs(2)).await;
let mut video_sender = video_sender.lock().unwrap();
let mut audio_sender = audio_sender.lock().unwrap();
if video_sender.is_some() {
@JBRS307 JBRS307 force-pushed the @jbrs/whip-input-handle branch from 0cb9df8 to 3b240c7 Compare May 8, 2026 08:10
@JBRS307 JBRS307 requested a review from wkozyra95 May 8, 2026 08:45
@JBRS307 JBRS307 marked this pull request as ready for review May 8, 2026 08:45
@JBRS307 JBRS307 changed the title WHIP input required track handled. WHIP / WHEP input required track handled. May 8, 2026
@JBRS307 JBRS307 force-pushed the @jbrs/whip-input-handle branch 3 times, most recently from db2a4dc to 7c13e68 Compare May 8, 2026 09:34
@JBRS307 JBRS307 requested a review from Copilot May 8, 2026 09:35
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 4 out of 4 changed files in this pull request and generated 5 comments.

Comment on lines +98 to +100
// Drop senders if appropriate tracks do not come within 2 seconds.
wait_for_tracks(video_sender.clone(), audio_sender.clone());

Comment thread smelter-core/src/pipeline/webrtc/whip_input/create_new_session.rs
let audio_sender = Arc::new(Mutex::new(audio_sender));

// Drop senders if appropriate tracks do not come within 2 seconds.
wait_for_tracks(video_sender.clone(), audio_sender.clone());
Comment thread smelter-core/src/pipeline/webrtc/whep_input/on_track.rs Outdated
Comment thread smelter-core/src/pipeline/webrtc/whep_input/on_track.rs
@JBRS307 JBRS307 force-pushed the @jbrs/whip-input-handle branch from 7c13e68 to dd7adbb Compare May 8, 2026 09:53
@JBRS307 JBRS307 changed the title WHIP / WHEP input required track handled. WHIP / WHEP input required single track fixed. May 8, 2026
@JBRS307 JBRS307 force-pushed the @jbrs/whip-input-handle branch 2 times, most recently from 741c1b0 to 286a7ab Compare May 19, 2026 08:10
@JBRS307 JBRS307 force-pushed the @jbrs/whip-input-handle branch from 286a7ab to 43de7cd Compare May 22, 2026 15:00
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.

3 participants