Skip to content

Commit e0e0b5a

Browse files
authored
remove AudioFrame.remix_and_resample (#385)
1 parent 306d981 commit e0e0b5a

File tree

1 file changed

+1
-24
lines changed

1 file changed

+1
-24
lines changed

livekit-rtc/livekit/rtc/audio_frame.py

+1-24
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
# limitations under the License.
1414

1515
import ctypes
16-
from ._ffi_client import FfiHandle, FfiClient
16+
from ._ffi_client import FfiHandle
1717
from ._proto import audio_frame_pb2 as proto_audio
18-
from ._proto import ffi_pb2 as proto_ffi
1918
from ._utils import get_address
2019
from typing import Any, Union
2120

@@ -93,28 +92,6 @@ def _from_owned_info(owned_info: proto_audio.OwnedAudioFrameBuffer) -> "AudioFra
9392
FfiHandle(owned_info.handle.id)
9493
return AudioFrame(data, info.sample_rate, info.num_channels, info.samples_per_channel)
9594

96-
def remix_and_resample(self, sample_rate: int, num_channels: int) -> "AudioFrame":
97-
"""Resample the audio frame to the given sample rate and number of channels.
98-
99-
.. warning::
100-
This method is deprecated and will be removed in a future release.
101-
Please use the `rtc.AudioResampler` class instead.
102-
"""
103-
req = proto_ffi.FfiRequest()
104-
req.new_audio_resampler.CopyFrom(proto_audio.NewAudioResamplerRequest())
105-
106-
resp = FfiClient.instance.request(req)
107-
resampler_handle = FfiHandle(resp.new_audio_resampler.resampler.handle.id)
108-
109-
resample_req = proto_ffi.FfiRequest()
110-
resample_req.remix_and_resample.resampler_handle = resampler_handle.handle
111-
resample_req.remix_and_resample.buffer.CopyFrom(self._proto_info())
112-
resample_req.remix_and_resample.sample_rate = sample_rate
113-
resample_req.remix_and_resample.num_channels = num_channels
114-
115-
resp = FfiClient.instance.request(resample_req)
116-
return AudioFrame._from_owned_info(resp.remix_and_resample.buffer)
117-
11895
def _proto_info(self) -> proto_audio.AudioFrameBufferInfo:
11996
audio_info = proto_audio.AudioFrameBufferInfo()
12097
audio_info.data_ptr = get_address(memoryview(self._data))

0 commit comments

Comments
 (0)