File tree Expand file tree Collapse file tree 1 file changed +7
-9
lines changed
Expand file tree Collapse file tree 1 file changed +7
-9
lines changed Original file line number Diff line number Diff line change 1313# limitations under the License.
1414
1515import asyncio
16- import logging
1716import ctypes
17+ import importlib .resources
18+ import logging
1819import os
1920import platform
2021import threading
2122from typing import Generic , List , Optional , TypeVar
2223
23- import pkg_resources
24-
2524from ._proto import ffi_pb2 as proto_ffi
2625from ._utils import Queue , classproperty
2726
2827logger = logging .getLogger ("livekit" )
2928
3029
31- def get_ffi_lib_path ():
30+ def get_ffi_lib ():
3231 # allow to override the lib path using an env var
3332 libpath = os .environ .get ("LIVEKIT_LIB_PATH" , "" ).strip ()
3433 if libpath :
@@ -46,13 +45,12 @@ def get_ffi_lib_path():
4645 Set LIVEKIT_LIB_PATH to specify a the lib path"
4746 )
4847
49- libpath = pkg_resources .resource_filename (
50- "livekit.rtc" , os .path .join ("resources" , libname )
51- )
52- return libpath
48+ with importlib .resources .path ("livekit.rtc.resources" , libname ) as resource_path :
49+ ffi_lib = ctypes .CDLL (resource_path )
50+ return ffi_lib
5351
5452
55- ffi_lib = ctypes . CDLL ( get_ffi_lib_path () )
53+ ffi_lib = get_ffi_lib ( )
5654ffi_cb_fnc = ctypes .CFUNCTYPE (None , ctypes .POINTER (ctypes .c_uint8 ), ctypes .c_size_t )
5755
5856# C function types
You can’t perform that action at this time.
0 commit comments