Skip to content

Conversation

@tschellenbach
Copy link
Member

@tschellenbach tschellenbach commented Nov 7, 2025

@tbarbugli

Summary by CodeRabbit

  • Bug Fixes
    • Preserve participant metadata across audio frame transformations (resample, copy, conversion) so participant info remains attached throughout the audio pipeline.
    • Improve audio queue overflow diagnostics by including contextual details (queue capacity and buffer duration) in warning messages for easier troubleshooting.

@coderabbitai
Copy link

coderabbitai bot commented Nov 7, 2025

Walkthrough

Added a participant attribute to PcmData and propagated it through PcmData creation/transformation paths; updated the audio track write() method's queue-overflow warning to include max_queue_size and pcm.duration_ms.

Changes

Cohort / File(s) Change Summary
Audio queue overflow logging
getstream/video/rtc/audio_track.py
Enhanced write() warning to include max_queue_size and pcm.duration_ms in the queue-overflow log message.
PCM data participant tracking
getstream/video/rtc/track_util.py
Added public participant: Any attribute to PcmData (__init__ signature updated) and propagated participant through to_float32, to_int16, copy, head, tail, resample, and other PcmData-producing paths to preserve participant context.

Sequence Diagram(s)

sequenceDiagram
    participant Writer as AudioStreamTrack.write()
    participant Queue as InternalQueue
    participant Logger as Logger
    participant PCM as PcmData

    Writer->>PCM: receive pcm (has .participant, .duration_ms)
    alt queue full
        Writer->>Logger: warn("queue overflow", max_queue_size, pcm.duration_ms)
        Writer-->>Queue: drop/skip pcm
    else enqueue
        Writer-->>Queue: push pcm
    end
Loading
sequenceDiagram
    participant Source as PcmData (source)
    participant Transform as to_float32 / resample / copy / head / tail
    participant Result as PcmData (result)

    Source->>Transform: transform(samples, ...)
    Transform->>Result: construct PcmData(..., participant=Source.participant)
    note right of Result: participant propagated
Loading

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

  • Pay attention to all places that construct new PcmData to ensure participant is passed consistently.
  • Verify no tests rely on PcmData constructor signature unchanged (default None behavior).
  • Check formatted log message does not raise issues when pcm is None or missing duration_ms.

Possibly related PRs

  • More audio utils #173 — Changes the same audio subsystem and PcmData/AudioStreamTrack paths; likely overlaps in participant propagation and AudioStreamTrack.write logging.

Poem

🐰 I hop through bytes and samples bright,
I tuck each name in PCM by night,
When queues complain, I add the clue —
size and ms to see it through. 🎧

Pre-merge checks and finishing touches

✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'add participant to pcm' directly and accurately describes the main change: adding a participant attribute to the PcmData class.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
✨ Finishing touches
  • 📝 Generate docstrings
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch participant

📜 Recent review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between 85bd8ef and 65a67e4.

📒 Files selected for processing (1)
  • getstream/video/rtc/track_util.py (11 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Tests (3.11)
  • GitHub Check: Tests (3.12)
  • GitHub Check: Tests (3.13)
  • GitHub Check: Tests (3.10)
🔇 Additional comments (7)
getstream/video/rtc/track_util.py (7)

100-100: Participant attribute properly added to PcmData.

The new participant attribute is well-integrated with complete documentation, appropriate type hints, and correct instance assignment. Using Any type provides flexibility for various participant context types.

Also applies to: 112-113, 125-125, 173-173


659-659: Participant correctly propagated in to_float32().


723-723: Participant correctly propagated in to_int16().


884-884: Participant correctly propagated in copy().


1299-1299: Participant correctly propagated in tail().


1408-1408: Participant correctly propagated in head().


1494-1494: Participant correctly propagated in Resampler.resample().

The comment accurately describes the preservation of participant context, and the implementation correctly passes it through.

Also applies to: 1503-1503


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.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
getstream/video/rtc/track_util.py (1)

101-101: Consider initializing participant in __init__ for clarity.

The class-level attribute definition works but may be confusing since it's not explicitly set in __init__. While Python allows this pattern (instance assignments shadow the class attribute), initializing it in __init__ would be more explicit and maintainable.

Apply this diff to initialize in __init__:

-    participant: Any = None
-
     def __init__(
         self,
         sample_rate: int,
@@ -111,6 +110,7 @@
         time_base: Optional[float] = None,
         channels: int = 1,
     ):
+        self.participant: Any = None
         """
         Initialize PcmData.
📜 Review details

Configuration used: CodeRabbit UI

Review profile: CHILL

Plan: Pro

Disabled knowledge base sources:

  • Linear integration is disabled by default for public repositories

You can enable these sources in your CodeRabbit configuration.

📥 Commits

Reviewing files that changed from the base of the PR and between b9966c3 and 85bd8ef.

📒 Files selected for processing (2)
  • getstream/video/rtc/audio_track.py (1 hunks)
  • getstream/video/rtc/track_util.py (2 hunks)
🧰 Additional context used
🧬 Code graph analysis (1)
getstream/video/rtc/audio_track.py (1)
getstream/video/rtc/track_util.py (1)
  • duration_ms (236-238)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (4)
  • GitHub Check: Tests (3.13)
  • GitHub Check: Tests (3.10)
  • GitHub Check: Tests (3.11)
  • GitHub Check: Tests (3.12)
🔇 Additional comments (1)
getstream/video/rtc/audio_track.py (1)

94-94: LGTM! Enhanced logging provides valuable context.

The addition of max_queue_size and pcm.duration_ms to the overflow warning improves debugging by showing both the queue limit and the duration of the PCM data being processed.

@tbarbugli tbarbugli merged commit 9bf5f4d into main Nov 9, 2025
4 of 5 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.

3 participants