wiseman / py-webrtcvad

Python interface to the WebRTC Voice Activity Detector
Other
2.07k stars 409 forks source link

WEBRTC_ARCH_*, PPC and environment variable? #78

Open th0ma7 opened 2 years ago

th0ma7 commented 2 years ago

Context

Using SynoCommunity spksrc framework and looking into migrating to newer python. The framework automatically build for multiple-archs. Part of my current PR I'm trying to reduce the usage local patches. PR: https://github.com/SynoCommunity/spksrc/pull/4998 Checks: https://github.com/SynoCommunity/spksrc/runs/4576241935?check_suite_focus=true

Specific

It happens that we currently patch the code to define WEBRTC_ARCH_LITTLE_ENDIAN Another method would be https://github.com/wiseman/py-webrtcvad/issues/41 but that isn't possible as we are batch processing all cross-compiled requirements with a generic pip call.

Ask

Would it be possible to provide the ability to use exported environment variable like some others projects do?

export WEBRTC_ARCH_LITTLE_ENDIAN=TRUE
or
export WEBRTC_ARCH=LITTLE_ENDIAN
or anything else...

Thnx in advance.

th0ma7 commented 2 years ago

The following solves my issue:

diff --git ./cbits/webrtc/typedefs.h ./cbits/webrtc/typedefs.h
index 51d8992..8286eca 100644
--- cbits/webrtc/typedefs.h
+++ cbits/webrtc/typedefs.h
@@ -47,6 +47,13 @@
 #elif defined(__pnacl__)
 #define WEBRTC_ARCH_32_BITS
 #define WEBRTC_ARCH_LITTLE_ENDIAN
+#elif defined(__PPC__)
+#if defined(__PPC64__)
+#define WEBRTC_ARCH_64_BITS
+#else
+#define WEBRTC_ARCH_32_BITS
+#endif
+#define WEBRTC_ARCH_BIG_ENDIAN
 #else
 #error Please add support for your architecture in typedefs.h
 #endif
th0ma7 commented 2 years ago

Also tried passing CFLAGS directly such as -D__PPC64__ -DWEBRTC_ARCH_64_BITS -DWEBRTC_ARCH_BIG_ENDIAN but that doesn't work. Only modifying the typedefs.h seems to work.

th0ma7 commented 2 years ago

I just noticed, all the code is good to go and already in this repository! https://github.com/wiseman/py-webrtcvad/commit/3bd761332a9404f5c9276105070ee814c4428342

Its just need another release to happen :)

@wiseman would it be possible to release a new version of the code as it already contains the fixes. Also making it available to pypi repository as well? Thnx in advance and happy holiday!

th0ma7 commented 2 years ago

Modifying my requirements.txt file as a workaround solves the issue until a new version gets released.

# webrtcvad==2.0.10           # requires unreleased version at specific commit
git+https://github.com/wiseman/py-webrtcvad@3bd761332a9404f5c9276105070ee814c4428342#egg=webrtcvad
daanzu commented 2 months ago

Fix available in fork: https://github.com/daanzu/py-webrtcvad-wheels