Skip to content

recording: Fix hang when deskshare audio ends before video - #24970

Merged
antobinary merged 1 commit into
bigbluebutton:v3.0.x-developfrom
kepstin:audio-edl-remove-gaps
Apr 24, 2026
Merged

antobinary merged 1 commit into
bigbluebutton:v3.0.x-developfrom
kepstin:audio-edl-remove-gaps

Conversation

@kepstin

@kepstin kepstin commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

What does this PR do?

In deskshare audio specifically, it's fairly common for the audio stream to stop before the video stream does, leaving a "gap" between the end of the audio stream and the end of the media file as a whole. Seeking into this gap breaks the audio processing, resulting in a hanging ffmpeg process.

Since the audio file gap handling code is already inspecting all of the timestamps, it's easy for it to detect this sort of "gap" at the end of the file, and mark it as a gap to be removed from the EDL, which solves the seek problem.

Closes Issue(s)

Issue was reported privately

Motivation

Processing of some recordings with deskshare were hanging indefinitely, preventing other recordings from processing.

How to test

Reproducing this issue requires a deskshare file where the audio is significantly shorter than the video, and also requires that there is another cut coincidentally during that gap caused by someone joining or leaving the audio on a server using livekit. It's very difficult to intentionally reproduce. I have several real recordings from Blindside Networks hosting which I have tested this change on, but which I am unfortunately not able to share.

Verifying that recordings without issues continue to process correctly is straightforwards.

More

  • Added/updated documentation

In deskshare audio specifically, it's fairly common for the audio stream
to stop before the video stream does, leaving a "gap" between the end
of the audio stream and the end of the media file as a whole. Seeking
into this gap breaks the audio processing, resulting in a hanging
ffmpeg process.

Since the audio file gap handling code is already inspecting all of the
timestamps, it's easy for it to detect this sort of "gap" at the end of
the file, and mark it as a gap to be removed from the EDL, which solves
the seek problem.
@coderabbitai

coderabbitai Bot commented Apr 24, 2026 •

Copy link
Copy Markdown
Contributor

Walkthrough

The changes modify the audio gap detection workflow by updating method signatures and introducing duration-based gap detection. The render method now passes the full audioinfo hash to remove_audio_gaps instead of only filenames. The remove_audio_gaps method is updated to iterate over audioinfo entries and supply each file's duration to pts_gaps. The pts_gaps method now accepts a required duration parameter and adds trailing gap detection when the computed end position is less than the file duration, marking gaps to the end of file with Float::INFINITY as the endpoint.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the main change: fixing a hang issue when deskshare audio ends before video, which is the core problem addressed by the modifications to audio gap detection logic.
Description check ✅ Passed The description thoroughly explains the issue (audio streams ending before video leaving a gap), the solution (detecting end-of-file gaps using existing audio gap-handling code), and testing approach, all directly related to the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@sonarqubecloud

Copy link
Copy Markdown

@antobinary antobinary added this to the Release 3.0 milestone Apr 24, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
record-and-playback/core/lib/recordandplayback/edl/media_utils.rb (1)

98-98: Nit: line exceeds RuboCop's 128-char limit (132).

🧹 Proposed wrap
-                BigBlueButton.logger.info("PTS gap detected between #{prev_end}ms and end of file at #{duration}ms (#{gap}ms long)")
+                BigBlueButton.logger.info(
+                  "PTS gap detected between #{prev_end}ms and end of file at #{duration}ms (#{gap}ms long)",
+                )
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@record-and-playback/core/lib/recordandplayback/edl/media_utils.rb` at line
98, The log line using BigBlueButton.logger.info exceeds RuboCop's 128-char
limit; break the long interpolation into a shorter concatenation or multiple
string parts so the final logged message stays under 128 chars — update the
BigBlueButton.logger.info call (the line referencing prev_end, duration and gap)
to wrap the string across two operands or use string interpolation split into
shorter segments to satisfy the RuboCop limit.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@record-and-playback/core/lib/recordandplayback/edl/media_utils.rb`:
- Line 98: The log line using BigBlueButton.logger.info exceeds RuboCop's
128-char limit; break the long interpolation into a shorter concatenation or
multiple string parts so the final logged message stays under 128 chars — update
the BigBlueButton.logger.info call (the line referencing prev_end, duration and
gap) to wrap the string across two operands or use string interpolation split
into shorter segments to satisfy the RuboCop limit.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 78ae92f7-8d9b-404f-9b78-9656a07c7584

📥 Commits

Reviewing files that changed from the base of the PR and between fcb3e62 and cdbd07a.

📒 Files selected for processing (2)
  • record-and-playback/core/lib/recordandplayback/edl/audio.rb
  • record-and-playback/core/lib/recordandplayback/edl/media_utils.rb

@github-actions

Copy link
Copy Markdown

✅ Automated tests have passed!

@antobinary antobinary mentioned this pull request Apr 24, 2026
6 of 9 tasks
@antobinary
antobinary merged commit 00059e8 into bigbluebutton:v3.0.x-develop Apr 24, 2026
33 checks passed
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