@@ -97,8 +97,8 @@ class PcmData:
9797 dts: The decode timestamp of the audio data.
9898 time_base: The time base for converting timestamps to seconds.
9999 channels: Number of audio channels (1=mono, 2=stereo)
100+ participant: The participant context for this audio data.
100101 """
101- participant : Any = None
102102
103103 def __init__ (
104104 self ,
@@ -109,6 +109,7 @@ def __init__(
109109 dts : Optional [int ] = None ,
110110 time_base : Optional [float ] = None ,
111111 channels : int = 1 ,
112+ participant : Any = None ,
112113 ):
113114 """
114115 Initialize PcmData.
@@ -121,6 +122,7 @@ def __init__(
121122 dts: The decode timestamp of the audio data
122123 time_base: The time base for converting timestamps to seconds
123124 channels: Number of audio channels (1=mono, 2=stereo)
125+ participant: The participant context for this audio data
124126
125127 Raises:
126128 TypeError: If samples dtype does not match the declared format
@@ -168,6 +170,7 @@ def __init__(
168170 self .dts : Optional [int ] = dts
169171 self .time_base : Optional [float ] = time_base
170172 self .channels : int = channels
173+ self .participant : Any = participant
171174
172175 @property
173176 def stereo (self ) -> bool :
@@ -530,9 +533,7 @@ def resample(
530533 resampler = Resampler (
531534 format = self .format , sample_rate = target_sample_rate , channels = target_channels
532535 )
533- pcm = resampler .resample (self )
534- pcm .participant = self .participant
535- return pcm
536+ return resampler .resample (self )
536537
537538 def to_bytes (self ) -> bytes :
538539 """Return interleaved PCM bytes.
@@ -655,6 +656,7 @@ def to_float32(self) -> "PcmData":
655656 dts = self .dts ,
656657 time_base = self .time_base ,
657658 channels = self .channels ,
659+ participant = self .participant ,
658660 )
659661
660662 def to_int16 (self ) -> "PcmData" :
@@ -718,6 +720,7 @@ def to_int16(self) -> "PcmData":
718720 dts = self .dts ,
719721 time_base = self .time_base ,
720722 channels = self .channels ,
723+ participant = self .participant ,
721724 )
722725
723726 def append (self , other : "PcmData" ) -> "PcmData" :
@@ -878,6 +881,7 @@ def copy(self) -> "PcmData":
878881 dts = self .dts ,
879882 time_base = self .time_base ,
880883 channels = self .channels ,
884+ participant = self .participant ,
881885 )
882886
883887 def clear (self ) -> None :
@@ -1292,6 +1296,7 @@ def tail(
12921296 dts = self .dts ,
12931297 time_base = self .time_base ,
12941298 channels = self .channels ,
1299+ participant = self .participant ,
12951300 )
12961301
12971302 def head (
@@ -1400,6 +1405,7 @@ def head(
14001405 dts = self .dts ,
14011406 time_base = self .time_base ,
14021407 channels = self .channels ,
1408+ participant = self .participant ,
14031409 )
14041410
14051411
@@ -1485,7 +1491,7 @@ def resample(self, pcm: PcmData) -> PcmData:
14851491 samples = self ._adjust_format (samples , current_format , self .format )
14861492 current_format = self .format
14871493
1488- # Create new PcmData with resampled audio, preserving timestamps
1494+ # Create new PcmData with resampled audio, preserving timestamps and participant
14891495 return PcmData (
14901496 samples = samples ,
14911497 sample_rate = self .sample_rate ,
@@ -1494,6 +1500,7 @@ def resample(self, pcm: PcmData) -> PcmData:
14941500 pts = pcm .pts ,
14951501 dts = pcm .dts ,
14961502 time_base = pcm .time_base ,
1503+ participant = pcm .participant ,
14971504 )
14981505
14991506 def _resample_1d (
0 commit comments