From 85bd8ef00859ef6ed5ef4ffe7b7f40ae12d12973 Mon Sep 17 00:00:00 2001 From: Thierry Schellenbach Date: Fri, 7 Nov 2025 11:16:32 -0700 Subject: [PATCH 1/2] add participant to pcm --- getstream/video/rtc/audio_track.py | 2 +- getstream/video/rtc/track_util.py | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/getstream/video/rtc/audio_track.py b/getstream/video/rtc/audio_track.py index a74a4b0f..735355a7 100644 --- a/getstream/video/rtc/audio_track.py +++ b/getstream/video/rtc/audio_track.py @@ -91,7 +91,7 @@ async def write(self, pcm: PcmData): break logger.warning( - "Audio queue overflow, dropped items", + "Audio queue overflow, dropped items max is %d. pcm duration %s ms", self.max_queue_size, pcm.duration_ms, extra={ "dropped_items": dropped_items, "queue_size": self._queue.qsize(), diff --git a/getstream/video/rtc/track_util.py b/getstream/video/rtc/track_util.py index d70a014a..46b689d2 100644 --- a/getstream/video/rtc/track_util.py +++ b/getstream/video/rtc/track_util.py @@ -98,6 +98,7 @@ class PcmData: time_base: The time base for converting timestamps to seconds. channels: Number of audio channels (1=mono, 2=stereo) """ + participant: Any = None def __init__( self, @@ -529,7 +530,9 @@ def resample( resampler = Resampler( format=self.format, sample_rate=target_sample_rate, channels=target_channels ) - return resampler.resample(self) + pcm = resampler.resample(self) + pcm.participant = self.participant + return pcm def to_bytes(self) -> bytes: """Return interleaved PCM bytes. From 65a67e4d7dfb98b43d4c52ece7759bea944ee5b0 Mon Sep 17 00:00:00 2001 From: Tommaso Barbugli Date: Sun, 9 Nov 2025 20:51:43 +0100 Subject: [PATCH 2/2] pass participant in all relevant methods --- getstream/video/rtc/track_util.py | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) diff --git a/getstream/video/rtc/track_util.py b/getstream/video/rtc/track_util.py index 46b689d2..6fcd60d5 100644 --- a/getstream/video/rtc/track_util.py +++ b/getstream/video/rtc/track_util.py @@ -97,8 +97,8 @@ class PcmData: dts: The decode timestamp of the audio data. time_base: The time base for converting timestamps to seconds. channels: Number of audio channels (1=mono, 2=stereo) + participant: The participant context for this audio data. """ - participant: Any = None def __init__( self, @@ -109,6 +109,7 @@ def __init__( dts: Optional[int] = None, time_base: Optional[float] = None, channels: int = 1, + participant: Any = None, ): """ Initialize PcmData. @@ -121,6 +122,7 @@ def __init__( dts: The decode timestamp of the audio data time_base: The time base for converting timestamps to seconds channels: Number of audio channels (1=mono, 2=stereo) + participant: The participant context for this audio data Raises: TypeError: If samples dtype does not match the declared format @@ -168,6 +170,7 @@ def __init__( self.dts: Optional[int] = dts self.time_base: Optional[float] = time_base self.channels: int = channels + self.participant: Any = participant @property def stereo(self) -> bool: @@ -530,9 +533,7 @@ def resample( resampler = Resampler( format=self.format, sample_rate=target_sample_rate, channels=target_channels ) - pcm = resampler.resample(self) - pcm.participant = self.participant - return pcm + return resampler.resample(self) def to_bytes(self) -> bytes: """Return interleaved PCM bytes. @@ -655,6 +656,7 @@ def to_float32(self) -> "PcmData": dts=self.dts, time_base=self.time_base, channels=self.channels, + participant=self.participant, ) def to_int16(self) -> "PcmData": @@ -718,6 +720,7 @@ def to_int16(self) -> "PcmData": dts=self.dts, time_base=self.time_base, channels=self.channels, + participant=self.participant, ) def append(self, other: "PcmData") -> "PcmData": @@ -878,6 +881,7 @@ def copy(self) -> "PcmData": dts=self.dts, time_base=self.time_base, channels=self.channels, + participant=self.participant, ) def clear(self) -> None: @@ -1292,6 +1296,7 @@ def tail( dts=self.dts, time_base=self.time_base, channels=self.channels, + participant=self.participant, ) def head( @@ -1400,6 +1405,7 @@ def head( dts=self.dts, time_base=self.time_base, channels=self.channels, + participant=self.participant, ) @@ -1485,7 +1491,7 @@ def resample(self, pcm: PcmData) -> PcmData: samples = self._adjust_format(samples, current_format, self.format) current_format = self.format - # Create new PcmData with resampled audio, preserving timestamps + # Create new PcmData with resampled audio, preserving timestamps and participant return PcmData( samples=samples, sample_rate=self.sample_rate, @@ -1494,6 +1500,7 @@ def resample(self, pcm: PcmData) -> PcmData: pts=pcm.pts, dts=pcm.dts, time_base=pcm.time_base, + participant=pcm.participant, ) def _resample_1d(