Make WebRTC library available

This commit is contained in:
Seth Alves 2019-06-27 08:43:59 -07:00
parent fe900cf55f
commit 32d5ab7b1f
8 changed files with 104 additions and 2 deletions

View file

@ -0,0 +1,16 @@
#
# Copyright 2019 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
#
macro(TARGET_WEBRTC)
if (ANDROID)
else()
target_include_directories(${TARGET_NAME} SYSTEM PUBLIC "${VCPKG_INSTALL_ROOT}/include/webrtc")
find_library(WEBRTC_LIBRARY NAMES webrtc PATHS ${VCPKG_INSTALL_ROOT}/lib/ NO_DEFAULT_PATH)
target_link_libraries(${TARGET_NAME} ${WEBRTC_LIBRARY})
endif()
endmacro()

View file

@ -1,4 +1,4 @@
Source: hifi-deps
Version: 0.1
Description: Collected dependencies for High Fidelity applications
Build-Depends: bullet3, draco, etc2comp, glm, nvtt, openexr (!android), openssl (windows), tbb (!android&!osx), zlib
Build-Depends: bullet3, draco, etc2comp, glm, nvtt, openexr (!android), openssl (windows), tbb (!android&!osx), zlib, webrtc (!android)

View file

@ -0,0 +1,3 @@
Source: webrtc
Version: 20190626
Description: WebRTC

View file

@ -0,0 +1,35 @@
include(vcpkg_common_functions)
set(WEBRTC_VERSION 20190626)
set(MASTER_COPY_SOURCE_PATH ${CURRENT_BUILDTREES_DIR}/src)
if (WIN32)
vcpkg_download_distfile(
WEBRTC_SOURCE_ARCHIVE
URLS https://hifi-public.s3.amazonaws.com/seth/webrtc-20190626-windows.zip
SHA512 f4444a95f87800b446d95a4c381b69a8ddc36d89a08ce57bf2b03d684ce528b592a3260ef2f9dee314e38b58dd236a3495677e1c7773ce3d4057f59e80b48f32
FILENAME webrtc-20190626-windows.zip
)
elseif (APPLE)
vcpkg_download_distfile(
WEBRTC_SOURCE_ARCHIVE
URLS https://hifi-public.s3.amazonaws.com/seth/webrtc-20190626-osx.tar.gz
SHA512 fc70cec1b5ee87395137b7090f424e2fc2300fc17d744d5ffa1cf7aa0e0f1a069a9d72ba1ad2fb4a640ebeb6c218bda24351ba0083e1ff96c4a4b5032648a9d2
FILENAME webrtc-20190626-osx.tar.gz
)
elseif (ANDROID)
# then not desktop Linux
else ()
vcpkg_download_distfile(
WEBRTC_SOURCE_ARCHIVE
URLS https://hifi-public.s3.amazonaws.com/seth/webrtc-20190626-linux.tar.gz
SHA512 7e41c3350e4dd3bbbedff9070ef0887db4e8d1607270ac2057cee3c8c2bf17aa2bdccb6c1bfa14526338a51b57d7896b7e1230c6cedb41f3afe5c49a5f1a7319
FILENAME webrtc-20190626-linux.tar.gz
)
endif ()
vcpkg_extract_source_archive(${WEBRTC_SOURCE_ARCHIVE})
file(COPY ${MASTER_COPY_SOURCE_PATH}/webrtc/include DESTINATION ${CURRENT_PACKAGES_DIR})
file(COPY ${MASTER_COPY_SOURCE_PATH}/webrtc/lib DESTINATION ${CURRENT_PACKAGES_DIR})
file(COPY ${MASTER_COPY_SOURCE_PATH}/webrtc/share DESTINATION ${CURRENT_PACKAGES_DIR})
file(COPY ${MASTER_COPY_SOURCE_PATH}/webrtc/debug DESTINATION ${CURRENT_PACKAGES_DIR})

View file

@ -7,6 +7,8 @@ link_hifi_libraries(audio plugins)
include_hifi_library_headers(shared)
include_hifi_library_headers(networking)
target_webrtc()
# append audio includes to our list of includes to bubble
target_include_directories(${TARGET_NAME} PUBLIC "${HIFI_LIBRARY_DIR}/audio/src")

View file

@ -24,7 +24,7 @@
#endif
#ifdef WIN32
#define WIN32_LEAN_AND_MEAN
#define WIN32_LEAN_AND_MEAN 1
#include <windows.h>
#include <Mmsystem.h>
#include <mmdeviceapi.h>
@ -302,6 +302,13 @@ AudioClient::AudioClient() :
_isHeadsetPluggedIn(false),
#endif
_orientationGetter(DEFAULT_ORIENTATION_GETTER) {
#if defined(WEBRTC_ENABLED)
qDebug() << "QQQQ calling AudioProcessingBuilder";
_apm = webrtc::AudioProcessingBuilder().Create();
qDebug() << "QQQQ done calling AudioProcessingBuilder";
#endif
// avoid putting a lock in the device callback
assert(_localSamplesAvailable.is_lock_free());

View file

@ -29,6 +29,7 @@
#include <AbstractAudioInterface.h>
#include <AudioEffectOptions.h>
#include <AudioStreamStats.h>
#include <shared/WebRTC.h>
#include <DependencyManager.h>
#include <HifiSockAddr.h>
@ -475,6 +476,10 @@ private:
QTimer* _checkPeakValuesTimer { nullptr };
bool _isRecording { false };
#if WEBRTC_ENABLED
webrtc::AudioProcessing* _apm;
#endif
};

View file

@ -0,0 +1,34 @@
//
// WebRTC.h
// libraries/shared/src/shared/
//
// Copyright 2019 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_WebRTC_h
#define hifi_WebRTC_h
#if defined(Q_OS_MAC)
# define WEBRTC_ENABLED 1
# define WEBRTC_POSIX 1
#elif defined(WIN32)
# define WEBRTC_ENABLED 1
# define WEBRTC_WIN 1
# define NOMINMAX 1
# define WIN32_LEAN_AND_MEAN 1
#elif defined(Q_OS_ANDROID)
// no webrtc for android -- this is here so the LINUX clause doesn't get used, below
#elif defined(Q_OS_LINUX)
# define WEBRTC_ENABLED 1
# define WEBRTC_POSIX 1
#endif
#if defined(WEBRTC_ENABLED)
# include <modules/audio_processing/include/audio_processing.h>
# include "modules/audio_processing/audio_processing_impl.h"
#endif
#endif // hifi_WebRTC_h