From 125841afc9d718ab0dbc50e94633cb1bff9210e4 Mon Sep 17 00:00:00 2001 From: Dale Glass Date: Sun, 27 Sep 2020 20:17:15 +0200 Subject: [PATCH] Remove the HiFiAC codec This is a proprietary codec and it's uncertain who can use it, and under what conditions. At this point, Opus is stable and a suitable replacement. --- android/apps/interface/CMakeLists.txt | 2 - android/apps/interface/build.gradle | 17 ---- android/apps/questInterface/CMakeLists.txt | 1 - android/apps/questInterface/build.gradle | 17 ---- android/build.gradle | 15 --- cmake/externals/hifiAudioCodec/CMakeLists.txt | 45 --------- cmake/macros/TargetHifiAudioCodec.cmake | 22 ----- .../resources/describe-settings.json | 4 +- hifi_android.py | 5 - plugins/CMakeLists.txt | 2 - plugins/hifiCodec/CMakeLists.txt | 15 --- plugins/hifiCodec/src/HiFiCodec.cpp | 95 ------------------- plugins/hifiCodec/src/HiFiCodec.h | 42 -------- plugins/hifiCodec/src/HiFiCodecProvider.cpp | 46 --------- plugins/hifiCodec/src/plugin.json | 4 - tools/ci-scripts/linux-gha/Dockerfile | 1 - 16 files changed, 2 insertions(+), 331 deletions(-) delete mode 100644 cmake/externals/hifiAudioCodec/CMakeLists.txt delete mode 100644 cmake/macros/TargetHifiAudioCodec.cmake delete mode 100644 plugins/hifiCodec/CMakeLists.txt delete mode 100644 plugins/hifiCodec/src/HiFiCodec.cpp delete mode 100644 plugins/hifiCodec/src/HiFiCodec.h delete mode 100644 plugins/hifiCodec/src/HiFiCodecProvider.cpp delete mode 100644 plugins/hifiCodec/src/plugin.json diff --git a/android/apps/interface/CMakeLists.txt b/android/apps/interface/CMakeLists.txt index 500d555915a..86fb02cdb58 100644 --- a/android/apps/interface/CMakeLists.txt +++ b/android/apps/interface/CMakeLists.txt @@ -7,8 +7,6 @@ target_bullet() set(INTERFACE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../interface") add_subdirectory("${INTERFACE_DIR}" "libraries/interface") include_directories("${INTERFACE_DIR}/src") -set(HIFI_CODEC_PLUGIN_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../plugins/hifiCodec") -add_subdirectory("${HIFI_CODEC_PLUGIN_DIR}" "libraries/hifiCodecPlugin") target_link_libraries(native-lib android log m interface) diff --git a/android/apps/interface/build.gradle b/android/apps/interface/build.gradle index bb2745ca22d..37bcc9ef69c 100644 --- a/android/apps/interface/build.gradle +++ b/android/apps/interface/build.gradle @@ -17,21 +17,6 @@ allprojects { } } -task renameHifiACTaskDebug() { - doLast { - def sourceFile = new File("${appDir}/build/intermediates/cmake/debug/obj/arm64-v8a/","libhifiCodec.so") - def destinationFile = new File("${appDir}/src/main/jniLibs/arm64-v8a", "libplugins_libhifiCodec.so") - copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } - } -} -task renameHifiACTaskRelease(type: Copy) { - doLast { - def sourceFile = new File("${appDir}/build/intermediates/cmake/release/obj/arm64-v8a/","libhifiCodec.so") - def destinationFile = new File("${appDir}/src/main/jniLibs/arm64-v8a", "libplugins_libhifiCodec.so") - copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } - } -} - apply plugin: 'com.android.application' android { @@ -109,10 +94,8 @@ android { // FIXME def uploadDumpSymsTask = rootProject.getTasksByName("uploadBreakpadDumpSyms${variant.name.capitalize()}", false).first() def runDumpSymsTask = rootProject.getTasksByName("runBreakpadDumpSyms${variant.name.capitalize()}", false).first() - def renameHifiACTask = rootProject.getTasksByName("renameHifiACTask${variant.name.capitalize()}", false).first() runDumpSymsTask.dependsOn(task) variant.assemble.dependsOn(uploadDumpSymsTask) - variant.mergeResources.dependsOn(renameHifiACTask) } } diff --git a/android/apps/questInterface/CMakeLists.txt b/android/apps/questInterface/CMakeLists.txt index 97ca46f6e5a..49b6f684b24 100644 --- a/android/apps/questInterface/CMakeLists.txt +++ b/android/apps/questInterface/CMakeLists.txt @@ -12,5 +12,4 @@ target_oculus_mobile() add_subdirectory("${CMAKE_SOURCE_DIR}/interface" "libraries/interface") include_directories("${CMAKE_SOURCE_DIR}/interface/src") -add_subdirectory("${CMAKE_SOURCE_DIR}/plugins/hifiCodec" "libraries/hifiCodecPlugin") target_link_libraries(questInterface android log m interface) diff --git a/android/apps/questInterface/build.gradle b/android/apps/questInterface/build.gradle index c54401a81bd..4c7a29bdfd3 100644 --- a/android/apps/questInterface/build.gradle +++ b/android/apps/questInterface/build.gradle @@ -1,21 +1,6 @@ import org.apache.tools.ant.taskdefs.condition.Os apply plugin: 'com.android.application' -task renameHifiACTaskDebug() { - doLast { - def sourceFile = new File("${appDir}/build/intermediates/cmake/debug/obj/arm64-v8a/","libhifiCodec.so") - def destinationFile = new File("${appDir}/src/main/jniLibs/arm64-v8a", "libplugins_libhifiCodec.so") - copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } - } -} -task renameHifiACTaskRelease(type: Copy) { - doLast { - def sourceFile = new File("${appDir}/build/intermediates/cmake/release/obj/arm64-v8a/","libhifiCodec.so") - def destinationFile = new File("${appDir}/src/main/jniLibs/arm64-v8a", "libplugins_libhifiCodec.so") - copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } - } -} - android { compileSdkVersion 28 defaultConfig { @@ -93,10 +78,8 @@ android { // FIXME def uploadDumpSymsTask = rootProject.getTasksByName("uploadBreakpadDumpSyms${variant.name.capitalize()}", false).first() def runDumpSymsTask = rootProject.getTasksByName("runBreakpadDumpSyms${variant.name.capitalize()}", false).first() - def renameHifiACTask = rootProject.getTasksByName("renameHifiACTask${variant.name.capitalize()}", false).first() runDumpSymsTask.dependsOn(task) variant.assemble.dependsOn(uploadDumpSymsTask) - variant.mergeResources.dependsOn(renameHifiACTask) } } diff --git a/android/build.gradle b/android/build.gradle index f0ff096614f..a90b103e116 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -232,21 +232,6 @@ task uploadBreakpadDumpSymsRelease(type:io.github.httpbuilderng.http.HttpTask, d } } -task renameHifiACTaskDebug() { - doLast { - def sourceFile = new File("${appDir}/build/intermediates/cmake/debug/obj/arm64-v8a/","libhifiCodec.so") - def destinationFile = new File("${appDir}/src/main/jniLibs/arm64-v8a", "libplugins_libhifiCodec.so") - copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } - } -} -task renameHifiACTaskRelease(type: Copy) { - doLast { - def sourceFile = new File("${appDir}/build/intermediates/cmake/release/obj/arm64-v8a/","libhifiCodec.so") - def destinationFile = new File("${appDir}/src/main/jniLibs/arm64-v8a", "libplugins_libhifiCodec.so") - copy { from sourceFile; into destinationFile.parent; rename(sourceFile.name, destinationFile.name) } - } -} - // FIXME this code is prototyping the desired functionality for doing build time binary dependency resolution. // See the comment on the qtBundle task above /* diff --git a/cmake/externals/hifiAudioCodec/CMakeLists.txt b/cmake/externals/hifiAudioCodec/CMakeLists.txt deleted file mode 100644 index 31454ace50e..00000000000 --- a/cmake/externals/hifiAudioCodec/CMakeLists.txt +++ /dev/null @@ -1,45 +0,0 @@ -include(ExternalProject) -include(SelectLibraryConfigurations) - -set(EXTERNAL_NAME hifiAudioCodec) - -string(TOUPPER ${EXTERNAL_NAME} EXTERNAL_NAME_UPPER) - -if (WIN32) - set(DOWNLOAD_URL "${EXTERNAL_BUILD_ASSETS}/dependencies/codecSDK-win-2.0.zip") - set(DOWNLOAD_MD5 9199d4dbd6b16bed736b235efe980e67) -elseif (APPLE) - set(DOWNLOAD_URL "${EXTERNAL_BUILD_ASSETS}/dependencies/codecSDK-mac-2.0.zip") - set(DOWNLOAD_MD5 21649881e7d5dc94f922179be96f76ba) -elseif (ANDROID) - set(DOWNLOAD_URL "${EXTERNAL_BUILD_ASSETS}/dependencies/codecSDK-android-2.0.zip") - set(DOWNLOAD_MD5 aef2a852600d498d58aa586668191683) -elseif (UNIX) - set(DOWNLOAD_URL "${EXTERNAL_BUILD_ASSETS}/dependencies/codecSDK-linux-2.0.zip") - set(DOWNLOAD_MD5 67fb7755f9bcafb98a9fceea53bc7481) -else() - return() -endif() - -ExternalProject_Add( - ${EXTERNAL_NAME} - URL ${DOWNLOAD_URL} - URL_MD5 ${DOWNLOAD_MD5} - CONFIGURE_COMMAND "" - BUILD_COMMAND "" - INSTALL_COMMAND "" - LOG_DOWNLOAD 1 -) - -# Hide this external target (for ide users) -set_target_properties(${EXTERNAL_NAME} PROPERTIES FOLDER "hidden/externals") - -ExternalProject_Get_Property(${EXTERNAL_NAME} SOURCE_DIR) - -set(${EXTERNAL_NAME_UPPER}_INCLUDE_DIRS ${SOURCE_DIR}/include CACHE STRING INTERNAL) - -if (WIN32) - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/Release/audio.lib CACHE STRING INTERNAL) -else() - set(${EXTERNAL_NAME_UPPER}_LIBRARIES ${SOURCE_DIR}/Release/libaudio.a CACHE STRING INTERNAL) -endif() diff --git a/cmake/macros/TargetHifiAudioCodec.cmake b/cmake/macros/TargetHifiAudioCodec.cmake deleted file mode 100644 index 4eaccc4f251..00000000000 --- a/cmake/macros/TargetHifiAudioCodec.cmake +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright 2018 High Fidelity, Inc. -# Created by Gabriel Calero and Cristian Duarte on 2018/10/05 -# -# Distributed under the Apache License, Version 2.0. -# See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -# -macro(TARGET_HIFIAUDIOCODEC) - if (ANDROID) - set(HIFIAC_INSTALL_DIR ${HIFI_ANDROID_PRECOMPILED}/hifiAC/codecSDK) - set(HIFIAC_LIB_DIR "${HIFIAC_INSTALL_DIR}/Release") - set(HIFIAC_INCLUDE_DIRS "${HIFIAC_INSTALL_DIR}/include" CACHE STRING INTERNAL) - list(APPEND HIFIAC_LIBS "${HIFIAC_LIB_DIR}/libaudio.a") - set(HIFIAC_LIBRARIES ${HIFIAC_LIBS} CACHE STRING INTERNAL) - else() - add_dependency_external_projects(hifiAudioCodec) - target_include_directories(${TARGET_NAME} PRIVATE ${HIFIAUDIOCODEC_INCLUDE_DIRS}) - target_link_libraries(${TARGET_NAME} ${HIFIAUDIOCODEC_LIBRARIES}) - endif() - target_include_directories(${TARGET_NAME} PRIVATE ${HIFIAC_INCLUDE_DIRS}) - target_link_libraries(${TARGET_NAME} ${HIFIAC_LIBRARIES}) -endmacro() diff --git a/domain-server/resources/describe-settings.json b/domain-server/resources/describe-settings.json index 7c99bd2e46b..15e32663954 100644 --- a/domain-server/resources/describe-settings.json +++ b/domain-server/resources/describe-settings.json @@ -1343,8 +1343,8 @@ "name": "codec_preference_order", "label": "Audio Codec Preference Order", "help": "List of codec names in order of preferred usage", - "placeholder": "opus, hifiAC, zlib, pcm", - "default": "opus,hifiAC,zlib,pcm", + "placeholder": "opus, zlib, pcm", + "default": "opus,zlib,pcm", "advanced": true } ] diff --git a/hifi_android.py b/hifi_android.py index 06640390d42..91d4d2740b7 100644 --- a/hifi_android.py +++ b/hifi_android.py @@ -67,11 +67,6 @@ 'sharedLibFolder': 'lib/release', 'includeLibs': ['libtbb.so', 'libtbbmalloc.so'], }, - 'hifiAC': { - 'baseUrl': 'https://cdn-1.vircadia.com/eu-c-1/vircadia-public/dependencies/', - 'file': 'codecSDK-android_armv8-2.0.zip', - 'checksum': '1cbef929675818fc64c4101b72f84a6a' - }, 'etc2comp': { 'file': 'etc2comp-patched-armv8-libcpp.tgz', 'checksum': '14b02795d774457a33bbc60e00a786bc' diff --git a/plugins/CMakeLists.txt b/plugins/CMakeLists.txt index 1448e14c722..a305eb4bc22 100644 --- a/plugins/CMakeLists.txt +++ b/plugins/CMakeLists.txt @@ -47,8 +47,6 @@ endif() # server-side plugins set(DIR "pcmCodec") add_subdirectory(${DIR}) -set(DIR "hifiCodec") -add_subdirectory(${DIR}) set(DIR "opusCodec") add_subdirectory(${DIR}) diff --git a/plugins/hifiCodec/CMakeLists.txt b/plugins/hifiCodec/CMakeLists.txt deleted file mode 100644 index 5515602d2f5..00000000000 --- a/plugins/hifiCodec/CMakeLists.txt +++ /dev/null @@ -1,15 +0,0 @@ -# -# Created by Brad Hefta-Gaub on 7/10/2016 -# Copyright 2016 High Fidelity, Inc. -# -# Distributed under the Apache License, Version 2.0. -# See the accompanying file LICENSE or http:#www.apache.org/licenses/LICENSE-2.0.html -# - -set(TARGET_NAME hifiCodec) -setup_hifi_client_server_plugin() -link_hifi_libraries(shared audio plugins) -target_hifiAudioCodec() -if (BUILD_SERVER) - install_beside_console() -endif () diff --git a/plugins/hifiCodec/src/HiFiCodec.cpp b/plugins/hifiCodec/src/HiFiCodec.cpp deleted file mode 100644 index a93e6c47d03..00000000000 --- a/plugins/hifiCodec/src/HiFiCodec.cpp +++ /dev/null @@ -1,95 +0,0 @@ -// -// HiFiCodec.cpp -// plugins/hifiCodec/src -// -// Created by Brad Hefta-Gaub on 7/10/2016 -// Copyright 2016 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include "HiFiCodec.h" - -#include -#include -#include - - -const char* HiFiCodec::NAME { "hifiAC" }; - -void HiFiCodec::init() { -} - -void HiFiCodec::deinit() { -} - -bool HiFiCodec::activate() { - CodecPlugin::activate(); - return true; -} - -void HiFiCodec::deactivate() { - CodecPlugin::deactivate(); -} - - -bool HiFiCodec::isSupported() const { - return true; -} - -class HiFiEncoder : public Encoder, public AudioEncoder { -public: - HiFiEncoder(int sampleRate, int numChannels) : AudioEncoder(sampleRate, numChannels) { - _encodedSize = (AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL * sizeof(int16_t) * numChannels) / 4; // codec reduces by 1/4th - } - - virtual void encode(const QByteArray& decodedBuffer, QByteArray& encodedBuffer) override { - PerformanceTimer perfTimer("HiFiEncoder::encode"); - - encodedBuffer.resize(_encodedSize); - AudioEncoder::process((const int16_t*)decodedBuffer.constData(), (int16_t*)encodedBuffer.data(), AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL); - } -private: - int _encodedSize; -}; - -class HiFiDecoder : public Decoder, public AudioDecoder { -public: - HiFiDecoder(int sampleRate, int numChannels) : AudioDecoder(sampleRate, numChannels) { - _decodedSize = AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL * sizeof(int16_t) * numChannels; - } - - virtual void decode(const QByteArray& encodedBuffer, QByteArray& decodedBuffer) override { - PerformanceTimer perfTimer("HiFiEncoder::decode"); - - decodedBuffer.resize(_decodedSize); - AudioDecoder::process((const int16_t*)encodedBuffer.constData(), (int16_t*)decodedBuffer.data(), AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL, true); - } - - virtual void lostFrame(QByteArray& decodedBuffer) override { - PerformanceTimer perfTimer("HiFiEncoder::lostFrame"); - - decodedBuffer.resize(_decodedSize); - // this performs packet loss interpolation - AudioDecoder::process(nullptr, (int16_t*)decodedBuffer.data(), AudioConstants::NETWORK_FRAME_SAMPLES_PER_CHANNEL, false); - } -private: - int _decodedSize; -}; - -Encoder* HiFiCodec::createEncoder(int sampleRate, int numChannels) { - return new HiFiEncoder(sampleRate, numChannels); -} - -Decoder* HiFiCodec::createDecoder(int sampleRate, int numChannels) { - return new HiFiDecoder(sampleRate, numChannels); -} - -void HiFiCodec::releaseEncoder(Encoder* encoder) { - delete encoder; -} - -void HiFiCodec::releaseDecoder(Decoder* decoder) { - delete decoder; -} diff --git a/plugins/hifiCodec/src/HiFiCodec.h b/plugins/hifiCodec/src/HiFiCodec.h deleted file mode 100644 index 09b247ff7e3..00000000000 --- a/plugins/hifiCodec/src/HiFiCodec.h +++ /dev/null @@ -1,42 +0,0 @@ -// -// HiFiCodec.h -// plugins/hifiCodec/src -// -// Created by Brad Hefta-Gaub on 7/10/2016 -// Copyright 2016 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#ifndef hifi_HiFiCodec_h -#define hifi_HiFiCodec_h - -#include - -class HiFiCodec : public CodecPlugin { - Q_OBJECT - -public: - // Plugin functions - bool isSupported() const override; - const QString getName() const override { return NAME; } - - void init() override; - void deinit() override; - - /// Called when a plugin is being activated for use. May be called multiple times. - bool activate() override; - /// Called when a plugin is no longer being used. May be called multiple times. - void deactivate() override; - - virtual Encoder* createEncoder(int sampleRate, int numChannels) override; - virtual Decoder* createDecoder(int sampleRate, int numChannels) override; - virtual void releaseEncoder(Encoder* encoder) override; - virtual void releaseDecoder(Decoder* decoder) override; - -private: - static const char* NAME; -}; - -#endif // hifi_HiFiCodec_h diff --git a/plugins/hifiCodec/src/HiFiCodecProvider.cpp b/plugins/hifiCodec/src/HiFiCodecProvider.cpp deleted file mode 100644 index b9698cc8217..00000000000 --- a/plugins/hifiCodec/src/HiFiCodecProvider.cpp +++ /dev/null @@ -1,46 +0,0 @@ -// -// Created by Brad Hefta-Gaub on 7/10/2016 -// Copyright 2016 High Fidelity, Inc. -// -// Distributed under the Apache License, Version 2.0. -// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html -// - -#include - -#include -#include -#include - -#include -#include - -#include "HiFiCodec.h" - -class HiFiCodecProvider : public QObject, public CodecProvider { - Q_OBJECT - Q_PLUGIN_METADATA(IID CodecProvider_iid FILE "plugin.json") - Q_INTERFACES(CodecProvider) - -public: - HiFiCodecProvider(QObject* parent = nullptr) : QObject(parent) {} - virtual ~HiFiCodecProvider() {} - - virtual CodecPluginList getCodecPlugins() override { - static std::once_flag once; - std::call_once(once, [&] { - - CodecPluginPointer hiFiCodec(new HiFiCodec()); - if (hiFiCodec->isSupported()) { - _codecPlugins.push_back(hiFiCodec); - } - - }); - return _codecPlugins; - } - -private: - CodecPluginList _codecPlugins; -}; - -#include "HiFiCodecProvider.moc" diff --git a/plugins/hifiCodec/src/plugin.json b/plugins/hifiCodec/src/plugin.json deleted file mode 100644 index 27391a484d4..00000000000 --- a/plugins/hifiCodec/src/plugin.json +++ /dev/null @@ -1,4 +0,0 @@ -{ - "name":"HiFi 4:1 Audio Codec", - "version":1 -} diff --git a/tools/ci-scripts/linux-gha/Dockerfile b/tools/ci-scripts/linux-gha/Dockerfile index 6809ec0460c..521ca54fda1 100644 --- a/tools/ci-scripts/linux-gha/Dockerfile +++ b/tools/ci-scripts/linux-gha/Dockerfile @@ -10,7 +10,6 @@ RUN mkdir -p /etc/hifi/server/plugins /etc/hifi/server/resources /etc/hifi/serve COPY ./assignment-client /etc/hifi/server/ #COPY ./oven /etc/hifi/server/ COPY ./domain-server /etc/hifi/server/ -COPY ./plugins/hifiCodec/libhifiCodec.so /etc/hifi/server/plugins/ RUN true COPY ./plugins/pcmCodec/libpcmCodec.so /etc/hifi/server/plugins/ # Dummy statement