Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions src/moq-output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -132,6 +132,9 @@ void MoQOutput::Stop(bool signal)
}
audio_tracks.clear();

// Clear bytes sent
total_bytes_sent = 0;

if (signal) {
obs_output_signal_stop(output, OBS_OUTPUT_SUCCESS);
}
Expand All @@ -147,6 +150,11 @@ void MoQOutput::Data(struct encoder_packet *packet)
return;
}

// OBS tries to gather data on signalling a stop success. Check once if the video tracks map is filled or new broadcasts fail on Windows.
if (video_tracks.empty()) {
return;
}
Comment on lines +153 to +156
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

Guard drops the first video packet and prevents track initialization forever.

This return runs before VideoData(), so video_tracks never gets initialized and all packets are skipped indefinitely.

Suggested fix
-	// OBS tries to gather data on signalling a stop success. Check once if the video tracks map is filled or new broadcasts fail on Windows.
-	if (video_tracks.empty()) {
+	// Ignore non-video packets until at least one video track is initialized.
+	// This still allows the first video packet through to create the track.
+	if (video_tracks.empty() && packet->type != OBS_ENCODER_VIDEO) {
 		return;
 	}
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/moq-output.cpp` around lines 153 - 156, The early return when
video_tracks.empty() causes the first video packet (and thus track
initialization in VideoData()) to be dropped and prevents any future
initialization; instead of returning from that block, change the logic to avoid
discarding the first packets—either remove the return and skip only
shutdown/failure paths, or replace the return with a no-op/continue and only
perform the guard after VideoData() runs (or after a dedicated initialized flag
is set). Locate the guard referencing video_tracks (and the VideoData()
consumer) and adjust it so the check does not run before track initialization
completes, ensuring VideoData() can populate video_tracks on the first packet.


if (packet->type == OBS_ENCODER_AUDIO) {
AudioData(packet);
} else if (packet->type == OBS_ENCODER_VIDEO) {
Expand Down
Loading