diff --git a/.travis.yml b/.travis.yml index 290417d5..1de2297d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -5,164 +5,164 @@ group: edge matrix: include: - # - os: linux - # compiler: gcc - # env: - # - COMPILER=g++-4.9 - # addons: - # apt: - # sources: - # - sourceline: 'ppa:mhier/libboost-latest' - # - ubuntu-toolchain-r-test - # packages: - # - g++-4.9 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon + - os: linux + compiler: gcc + env: + - COMPILER=g++-4.9 + addons: + apt: + sources: + - sourceline: 'ppa:mhier/libboost-latest' + - ubuntu-toolchain-r-test + packages: + - g++-4.9 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon - # - os: linux - # compiler: gcc - # env: - # - COMPILER=g++-5 - # addons: - # apt: - # sources: - # - sourceline: 'ppa:mhier/libboost-latest' - # - ubuntu-toolchain-r-test - # packages: - # - g++-5 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon + - os: linux + compiler: gcc + env: + - COMPILER=g++-5 + addons: + apt: + sources: + - sourceline: 'ppa:mhier/libboost-latest' + - ubuntu-toolchain-r-test + packages: + - g++-5 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon - # - os: linux - # compiler: gcc - # env: - # - COMPILER=g++-6 - # addons: - # apt: - # sources: - # - sourceline: 'ppa:mhier/libboost-latest' - # - ubuntu-toolchain-r-test - # packages: - # - g++-6 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon + - os: linux + compiler: gcc + env: + - COMPILER=g++-6 + addons: + apt: + sources: + - sourceline: 'ppa:mhier/libboost-latest' + - ubuntu-toolchain-r-test + packages: + - g++-6 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon - # - os: linux - # compiler: gcc - # env: - # - COMPILER=g++-7 - # addons: - # apt: - # sources: - # - sourceline: 'ppa:mhier/libboost-latest' - # - ubuntu-toolchain-r-test - # packages: - # - g++-7 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon + - os: linux + compiler: gcc + env: + - COMPILER=g++-7 + addons: + apt: + sources: + - sourceline: 'ppa:mhier/libboost-latest' + - ubuntu-toolchain-r-test + packages: + - g++-7 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon - # - os: linux - # compiler: gcc - # env: - # - COMPILER=g++-8 - # addons: - # apt: - # sources: - # - sourceline: 'ppa:mhier/libboost-latest' - # - ubuntu-toolchain-r-test - # packages: - # - g++-8 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon + - os: linux + compiler: gcc + env: + - COMPILER=g++-8 + addons: + apt: + sources: + - sourceline: 'ppa:mhier/libboost-latest' + - ubuntu-toolchain-r-test + packages: + - g++-8 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon - # - os: linux - # compiler: gcc - # env: - # - COMPILER=g++-9 - # addons: - # apt: - # sources: - # - sourceline: 'ppa:mhier/libboost-latest' - # - ubuntu-toolchain-r-test - # packages: - # - g++-9 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon + - os: linux + compiler: gcc + env: + - COMPILER=g++-9 + addons: + apt: + sources: + - sourceline: 'ppa:mhier/libboost-latest' + - ubuntu-toolchain-r-test + packages: + - g++-9 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon - # - os: linux - # compiler: clang - # env: - # - COMPILER=clang++-3.9 - # - CXXFLAGS=-stdlib=libc++ - # - CC=clang-3.9 - # addons: - # apt: - # sources: - # - sourceline: 'ppa:mhier/libboost-latest' - # - llvm-toolchain-trusty-3.9 - # packages: - # - clang-3.9 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon + - os: linux + compiler: clang + env: + - COMPILER=clang++-3.9 + - CXXFLAGS=-stdlib=libc++ + - CC=clang-3.9 + addons: + apt: + sources: + - sourceline: 'ppa:mhier/libboost-latest' + - llvm-toolchain-trusty-3.9 + packages: + - clang-3.9 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon - # - os: linux - # compiler: clang - # env: - # - COMPILER=clang++-4.0 - # - CXXFLAGS=-stdlib=libc++ - # - CC=clang-4.0 - # addons: - # apt: - # sources: - # - sourceline: 'ppa:mhier/libboost-latest' - # - llvm-toolchain-trusty-4.0 - # packages: - # - clang-4.0 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon + - os: linux + compiler: clang + env: + - COMPILER=clang++-4.0 + - CXXFLAGS=-stdlib=libc++ + - CC=clang-4.0 + addons: + apt: + sources: + - sourceline: 'ppa:mhier/libboost-latest' + - llvm-toolchain-trusty-4.0 + packages: + - clang-4.0 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon - # - os: linux - # compiler: clang - # env: - # - COMPILER=clang++-5.0 - # - CXXFLAGS=-stdlib=libc++ - # - CC=clang-5.0 - # addons: - # apt: - # sources: - # - sourceline: 'ppa:mhier/libboost-latest' - # - llvm-toolchain-trusty-5.0 - # packages: - # - clang-5.0 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon + - os: linux + compiler: clang + env: + - COMPILER=clang++-5.0 + - CXXFLAGS=-stdlib=libc++ + - CC=clang-5.0 + addons: + apt: + sources: + - sourceline: 'ppa:mhier/libboost-latest' + - llvm-toolchain-trusty-5.0 + packages: + - clang-5.0 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon - # - os: linux - # compiler: clang - # env: - # - COMPILER=clang++-6.0 - # - CXXFLAGS=-stdlib=libc++ - # addons: - # apt: - # sources: - # - sourceline: 'ppa:mhier/libboost-latest' - # - llvm-toolchain-trusty-6.0 - # - ubuntu-toolchain-r-test - # packages: - # - clang-6.0 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon + - os: linux + compiler: clang + env: + - COMPILER=clang++-6.0 + - CXXFLAGS=-stdlib=libc++ + addons: + apt: + sources: + - sourceline: 'ppa:mhier/libboost-latest' + - llvm-toolchain-trusty-6.0 + - ubuntu-toolchain-r-test + packages: + - clang-6.0 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon - # - os: linux - # compiler: clang - # env: - # - COMPILER=clang++-7 - # - CXXFLAGS=-stdlib=libc++ - # addons: - # apt: - # sources: - # - sourceline: 'ppa:mhier/libboost-latest' - # - llvm-toolchain-trusty-7 - # - ubuntu-toolchain-r-test - # packages: - # - clang-7 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon + - os: linux + compiler: clang + env: + - COMPILER=clang++-7 + - CXXFLAGS=-stdlib=libc++ + addons: + apt: + sources: + - sourceline: 'ppa:mhier/libboost-latest' + - llvm-toolchain-trusty-7 + - ubuntu-toolchain-r-test + packages: + - clang-7 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon - # # build on osx - # - os: osx - # osx_image: xcode9.4 - # env: - # - MATRIX_EVAL="brew update && brew unlink python@2 && brew upgrade boost && brew install flac opus libvorbis libsoxr" + # build on osx + - os: osx + osx_image: xcode9.4 + env: + - MATRIX_EVAL="brew update && brew unlink python@2 && brew upgrade boost && brew install flac opus libvorbis libsoxr" - # - os: osx - # osx_image: xcode10.3 - # env: - # - MATRIX_EVAL="brew update && brew install flac opus libvorbis libsoxr" + - os: osx + osx_image: xcode10.3 + env: + - MATRIX_EVAL="brew update && brew install flac opus libvorbis libsoxr" - # - os: osx - # osx_image: xcode11 - # env: - # - MATRIX_EVAL="brew update && brew install flac opus libvorbis libsoxr" + - os: osx + osx_image: xcode11 + env: + - MATRIX_EVAL="brew update && brew install flac opus libvorbis libsoxr" # build on windows - os: windows diff --git a/client/decoder/ogg_decoder.cpp b/client/decoder/ogg_decoder.cpp index f0ac49d4..eff4b896 100644 --- a/client/decoder/ogg_decoder.cpp +++ b/client/decoder/ogg_decoder.cpp @@ -17,6 +17,7 @@ ***/ #include +#include #include #include @@ -115,9 +116,9 @@ bool OggDecoder::decode(msg::PcmChunk* chunk) { int8_t& val = chunkBuffer[sampleFormat_.channels() * i + channel]; #ifdef HAS_TREMOR - val = clip(pcm[channel][i], -128, 127); + val = clip(pcm[channel][i], INT8_MIN, INT8_MAX); #else - val = clip(floor(pcm[channel][i] * 127.f + .5f), -128, 127); + val = clip(floor(pcm[channel][i] * 127.f + .5f), INT8_MIN, INT8_MAX); #endif } } @@ -128,9 +129,9 @@ bool OggDecoder::decode(msg::PcmChunk* chunk) { int16_t& val = chunkBuffer[sampleFormat_.channels() * i + channel]; #ifdef HAS_TREMOR - val = SWAP_16(clip(pcm[channel][i] >> 9, -32768, 32767)); + val = SWAP_16(clip(pcm[channel][i] >> 9, INT16_MIN, INT16_MAX)); #else - val = SWAP_16(clip(floor(pcm[channel][i] * 32767.f + .5f), -32768, 32767)); + val = SWAP_16(clip(floor(pcm[channel][i] * 32767.f + .5f), INT16_MIN, INT16_MAX)); #endif } } @@ -141,9 +142,9 @@ bool OggDecoder::decode(msg::PcmChunk* chunk) { int32_t& val = chunkBuffer[sampleFormat_.channels() * i + channel]; #ifdef HAS_TREMOR - val = SWAP_32(clip(pcm[channel][i] << 7, -2147483648, 2147483647)); + val = SWAP_32(clip(pcm[channel][i] << 7, INT32_MIN, INT32_MAX)); #else - val = SWAP_32(clip(floor(pcm[channel][i] * 2147483647.f + .5f), -2147483648, 2147483647)); + val = SWAP_32(clip(floor(pcm[channel][i] * 2147483647.f + .5f), INT32_MIN, INT32_MAX)); #endif } } diff --git a/client/decoder/ogg_decoder.hpp b/client/decoder/ogg_decoder.hpp index 60a335d2..b20182fc 100644 --- a/client/decoder/ogg_decoder.hpp +++ b/client/decoder/ogg_decoder.hpp @@ -42,12 +42,12 @@ private: template T clip(const IN_TYPE& value, const T& lower, const T& upper) const { - auto val = static_cast(value); + auto val = static_cast(value); if (val > upper) return upper; if (val < lower) return lower; - return val; + return static_cast(value); } ogg_sync_state oy; /// sync and verify incoming physical bitstream