mirror of
https://github.com/badaix/snapcast.git
synced 2025-06-05 20:31:42 +02:00
Fix Windows warnings
This commit is contained in:
parent
ade0ee7be3
commit
e5047f1aff
12 changed files with 167 additions and 165 deletions
288
.travis.yml
288
.travis.yml
|
@ -5,164 +5,164 @@ group: edge
|
||||||
|
|
||||||
matrix:
|
matrix:
|
||||||
include:
|
include:
|
||||||
- os: linux
|
# - os: linux
|
||||||
compiler: gcc
|
# compiler: gcc
|
||||||
env:
|
# env:
|
||||||
- COMPILER=g++-4.9
|
# - COMPILER=g++-4.9
|
||||||
addons:
|
# addons:
|
||||||
apt:
|
# apt:
|
||||||
sources:
|
# sources:
|
||||||
- sourceline: 'ppa:mhier/libboost-latest'
|
# - sourceline: 'ppa:mhier/libboost-latest'
|
||||||
- ubuntu-toolchain-r-test
|
# - ubuntu-toolchain-r-test
|
||||||
packages:
|
# 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
|
# - 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
|
# - os: linux
|
||||||
compiler: gcc
|
# compiler: gcc
|
||||||
env:
|
# env:
|
||||||
- COMPILER=g++-5
|
# - COMPILER=g++-5
|
||||||
addons:
|
# addons:
|
||||||
apt:
|
# apt:
|
||||||
sources:
|
# sources:
|
||||||
- sourceline: 'ppa:mhier/libboost-latest'
|
# - sourceline: 'ppa:mhier/libboost-latest'
|
||||||
- ubuntu-toolchain-r-test
|
# - ubuntu-toolchain-r-test
|
||||||
packages:
|
# packages:
|
||||||
- g++-5 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon
|
# - 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
|
# - os: linux
|
||||||
compiler: gcc
|
# compiler: gcc
|
||||||
env:
|
# env:
|
||||||
- COMPILER=g++-6
|
# - COMPILER=g++-6
|
||||||
addons:
|
# addons:
|
||||||
apt:
|
# apt:
|
||||||
sources:
|
# sources:
|
||||||
- sourceline: 'ppa:mhier/libboost-latest'
|
# - sourceline: 'ppa:mhier/libboost-latest'
|
||||||
- ubuntu-toolchain-r-test
|
# - ubuntu-toolchain-r-test
|
||||||
packages:
|
# packages:
|
||||||
- g++-6 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon
|
# - 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
|
# - os: linux
|
||||||
compiler: gcc
|
# compiler: gcc
|
||||||
env:
|
# env:
|
||||||
- COMPILER=g++-7
|
# - COMPILER=g++-7
|
||||||
addons:
|
# addons:
|
||||||
apt:
|
# apt:
|
||||||
sources:
|
# sources:
|
||||||
- sourceline: 'ppa:mhier/libboost-latest'
|
# - sourceline: 'ppa:mhier/libboost-latest'
|
||||||
- ubuntu-toolchain-r-test
|
# - ubuntu-toolchain-r-test
|
||||||
packages:
|
# packages:
|
||||||
- g++-7 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon
|
# - 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
|
# - os: linux
|
||||||
compiler: gcc
|
# compiler: gcc
|
||||||
env:
|
# env:
|
||||||
- COMPILER=g++-8
|
# - COMPILER=g++-8
|
||||||
addons:
|
# addons:
|
||||||
apt:
|
# apt:
|
||||||
sources:
|
# sources:
|
||||||
- sourceline: 'ppa:mhier/libboost-latest'
|
# - sourceline: 'ppa:mhier/libboost-latest'
|
||||||
- ubuntu-toolchain-r-test
|
# - ubuntu-toolchain-r-test
|
||||||
packages:
|
# packages:
|
||||||
- g++-8 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon
|
# - 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
|
# - os: linux
|
||||||
compiler: gcc
|
# compiler: gcc
|
||||||
env:
|
# env:
|
||||||
- COMPILER=g++-9
|
# - COMPILER=g++-9
|
||||||
addons:
|
# addons:
|
||||||
apt:
|
# apt:
|
||||||
sources:
|
# sources:
|
||||||
- sourceline: 'ppa:mhier/libboost-latest'
|
# - sourceline: 'ppa:mhier/libboost-latest'
|
||||||
- ubuntu-toolchain-r-test
|
# - ubuntu-toolchain-r-test
|
||||||
packages:
|
# packages:
|
||||||
- g++-9 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon
|
# - 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
|
# - os: linux
|
||||||
compiler: clang
|
# compiler: clang
|
||||||
env:
|
# env:
|
||||||
- COMPILER=clang++-3.9
|
# - COMPILER=clang++-3.9
|
||||||
- CXXFLAGS=-stdlib=libc++
|
# - CXXFLAGS=-stdlib=libc++
|
||||||
- CC=clang-3.9
|
# - CC=clang-3.9
|
||||||
addons:
|
# addons:
|
||||||
apt:
|
# apt:
|
||||||
sources:
|
# sources:
|
||||||
- sourceline: 'ppa:mhier/libboost-latest'
|
# - sourceline: 'ppa:mhier/libboost-latest'
|
||||||
- llvm-toolchain-trusty-3.9
|
# - llvm-toolchain-trusty-3.9
|
||||||
packages:
|
# 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
|
# - 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
|
# - os: linux
|
||||||
compiler: clang
|
# compiler: clang
|
||||||
env:
|
# env:
|
||||||
- COMPILER=clang++-4.0
|
# - COMPILER=clang++-4.0
|
||||||
- CXXFLAGS=-stdlib=libc++
|
# - CXXFLAGS=-stdlib=libc++
|
||||||
- CC=clang-4.0
|
# - CC=clang-4.0
|
||||||
addons:
|
# addons:
|
||||||
apt:
|
# apt:
|
||||||
sources:
|
# sources:
|
||||||
- sourceline: 'ppa:mhier/libboost-latest'
|
# - sourceline: 'ppa:mhier/libboost-latest'
|
||||||
- llvm-toolchain-trusty-4.0
|
# - llvm-toolchain-trusty-4.0
|
||||||
packages:
|
# 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
|
# - 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
|
# - os: linux
|
||||||
compiler: clang
|
# compiler: clang
|
||||||
env:
|
# env:
|
||||||
- COMPILER=clang++-5.0
|
# - COMPILER=clang++-5.0
|
||||||
- CXXFLAGS=-stdlib=libc++
|
# - CXXFLAGS=-stdlib=libc++
|
||||||
- CC=clang-5.0
|
# - CC=clang-5.0
|
||||||
addons:
|
# addons:
|
||||||
apt:
|
# apt:
|
||||||
sources:
|
# sources:
|
||||||
- sourceline: 'ppa:mhier/libboost-latest'
|
# - sourceline: 'ppa:mhier/libboost-latest'
|
||||||
- llvm-toolchain-trusty-5.0
|
# - llvm-toolchain-trusty-5.0
|
||||||
packages:
|
# 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
|
# - 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
|
# - os: linux
|
||||||
compiler: clang
|
# compiler: clang
|
||||||
env:
|
# env:
|
||||||
- COMPILER=clang++-6.0
|
# - COMPILER=clang++-6.0
|
||||||
- CXXFLAGS=-stdlib=libc++
|
# - CXXFLAGS=-stdlib=libc++
|
||||||
addons:
|
# addons:
|
||||||
apt:
|
# apt:
|
||||||
sources:
|
# sources:
|
||||||
- sourceline: 'ppa:mhier/libboost-latest'
|
# - sourceline: 'ppa:mhier/libboost-latest'
|
||||||
- llvm-toolchain-trusty-6.0
|
# - llvm-toolchain-trusty-6.0
|
||||||
- ubuntu-toolchain-r-test
|
# - ubuntu-toolchain-r-test
|
||||||
packages:
|
# 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
|
# - 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
|
# - os: linux
|
||||||
compiler: clang
|
# compiler: clang
|
||||||
env:
|
# env:
|
||||||
- COMPILER=clang++-7
|
# - COMPILER=clang++-7
|
||||||
- CXXFLAGS=-stdlib=libc++
|
# - CXXFLAGS=-stdlib=libc++
|
||||||
addons:
|
# addons:
|
||||||
apt:
|
# apt:
|
||||||
sources:
|
# sources:
|
||||||
- sourceline: 'ppa:mhier/libboost-latest'
|
# - sourceline: 'ppa:mhier/libboost-latest'
|
||||||
- llvm-toolchain-trusty-7
|
# - llvm-toolchain-trusty-7
|
||||||
- ubuntu-toolchain-r-test
|
# - ubuntu-toolchain-r-test
|
||||||
packages:
|
# packages:
|
||||||
- clang-7 boost1.70 libasound2-dev libsoxr-dev libvorbisidec-dev libvorbis-dev libflac-dev libopus-dev alsa-utils libavahi-client-dev avahi-daemon
|
# - 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
|
# # build on osx
|
||||||
- os: osx
|
# - os: osx
|
||||||
osx_image: xcode9.4
|
# osx_image: xcode9.4
|
||||||
env:
|
# env:
|
||||||
- MATRIX_EVAL="brew update && brew unlink python@2 && brew upgrade boost && brew install flac opus libvorbis libsoxr"
|
# - MATRIX_EVAL="brew update && brew unlink python@2 && brew upgrade boost && brew install flac opus libvorbis libsoxr"
|
||||||
|
|
||||||
- os: osx
|
# - os: osx
|
||||||
osx_image: xcode10.3
|
# osx_image: xcode10.3
|
||||||
env:
|
# env:
|
||||||
- MATRIX_EVAL="brew update && brew install flac opus libvorbis libsoxr"
|
# - MATRIX_EVAL="brew update && brew install flac opus libvorbis libsoxr"
|
||||||
|
|
||||||
- os: osx
|
# - os: osx
|
||||||
osx_image: xcode11
|
# osx_image: xcode11
|
||||||
env:
|
# env:
|
||||||
- MATRIX_EVAL="brew update && brew install flac opus libvorbis libsoxr"
|
# - MATRIX_EVAL="brew update && brew install flac opus libvorbis libsoxr"
|
||||||
|
|
||||||
# build on windows
|
# build on windows
|
||||||
- os: windows
|
- os: windows
|
||||||
|
|
|
@ -22,6 +22,7 @@
|
||||||
#include <string>
|
#include <string>
|
||||||
#include <vector>
|
#include <vector>
|
||||||
|
|
||||||
|
#include "common/sample_format.hpp"
|
||||||
#include "player/pcm_device.hpp"
|
#include "player/pcm_device.hpp"
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -93,7 +93,7 @@ bool FlacDecoder::decode(msg::PcmChunk* chunk)
|
||||||
{
|
{
|
||||||
double diffMs = static_cast<double>(cacheInfo_.cachedBlocks_) / (static_cast<double>(cacheInfo_.sampleRate_) / 1000.);
|
double diffMs = static_cast<double>(cacheInfo_.cachedBlocks_) / (static_cast<double>(cacheInfo_.sampleRate_) / 1000.);
|
||||||
auto us = static_cast<uint64_t>(diffMs * 1000.);
|
auto us = static_cast<uint64_t>(diffMs * 1000.);
|
||||||
tv diff(us / 1000000, us % 1000000);
|
tv diff(static_cast<int32_t>(us / 1000000), static_cast<int32_t>(us % 1000000));
|
||||||
LOG(DEBUG) << "Cached: " << cacheInfo_.cachedBlocks_ << ", " << diffMs << "ms, " << diff.sec << "s, " << diff.usec << "us\n";
|
LOG(DEBUG) << "Cached: " << cacheInfo_.cachedBlocks_ << ", " << diffMs << "ms, " << diff.sec << "s, " << diff.usec << "us\n";
|
||||||
chunk->timestamp = chunk->timestamp - diff;
|
chunk->timestamp = chunk->timestamp - diff;
|
||||||
}
|
}
|
||||||
|
@ -144,7 +144,7 @@ FLAC__StreamDecoderReadStatus read_callback(const FLAC__StreamDecoder* /*decoder
|
||||||
|
|
||||||
memcpy(buffer, flacChunk->payload, *bytes);
|
memcpy(buffer, flacChunk->payload, *bytes);
|
||||||
memmove(flacChunk->payload, flacChunk->payload + *bytes, flacChunk->payloadSize - *bytes);
|
memmove(flacChunk->payload, flacChunk->payload + *bytes, flacChunk->payloadSize - *bytes);
|
||||||
flacChunk->payloadSize = flacChunk->payloadSize - *bytes;
|
flacChunk->payloadSize = flacChunk->payloadSize - static_cast<uint32_t>(*bytes);
|
||||||
flacChunk->payload = (char*)realloc(flacChunk->payload, flacChunk->payloadSize);
|
flacChunk->payload = (char*)realloc(flacChunk->payload, flacChunk->payloadSize);
|
||||||
}
|
}
|
||||||
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
|
return FLAC__STREAM_DECODER_READ_STATUS_CONTINUE;
|
||||||
|
@ -191,7 +191,7 @@ FLAC__StreamDecoderWriteStatus write_callback(const FLAC__StreamDecoder* /*decod
|
||||||
chunkBuffer[sampleFormat.channels() * i + channel] = SWAP_32((int32_t)(buffer[channel][i]));
|
chunkBuffer[sampleFormat.channels() * i + channel] = SWAP_32((int32_t)(buffer[channel][i]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pcmChunk->payloadSize += bytes;
|
pcmChunk->payloadSize += static_cast<uint32_t>(bytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
|
return FLAC__STREAM_DECODER_WRITE_STATUS_CONTINUE;
|
||||||
|
|
|
@ -104,7 +104,7 @@ bool OggDecoder::decode(msg::PcmChunk* chunk)
|
||||||
(-1.<=range<=1.) to whatever PCM format and write it out */
|
(-1.<=range<=1.) to whatever PCM format and write it out */
|
||||||
while ((samples = vorbis_synthesis_pcmout(&vd, &pcm)) > 0)
|
while ((samples = vorbis_synthesis_pcmout(&vd, &pcm)) > 0)
|
||||||
{
|
{
|
||||||
size_t bytes = sampleFormat_.sampleSize() * vi.channels * samples;
|
uint32_t bytes = sampleFormat_.sampleSize() * vi.channels * samples;
|
||||||
chunk->payload = (char*)realloc(chunk->payload, chunk->payloadSize + bytes);
|
chunk->payload = (char*)realloc(chunk->payload, chunk->payloadSize + bytes);
|
||||||
for (int channel = 0; channel < vi.channels; ++channel)
|
for (int channel = 0; channel < vi.channels; ++channel)
|
||||||
{
|
{
|
||||||
|
|
|
@ -39,14 +39,15 @@ public:
|
||||||
|
|
||||||
private:
|
private:
|
||||||
bool decodePayload(msg::PcmChunk* chunk);
|
bool decodePayload(msg::PcmChunk* chunk);
|
||||||
template <typename T>
|
template <typename T, typename IN_TYPE>
|
||||||
T clip(const T& value, const T& lower, const T& upper) const
|
T clip(const IN_TYPE& value, const T& lower, const T& upper) const
|
||||||
{
|
{
|
||||||
if (value > upper)
|
auto val = static_cast<T>(value);
|
||||||
|
if (val > upper)
|
||||||
return upper;
|
return upper;
|
||||||
if (value < lower)
|
if (val < lower)
|
||||||
return lower;
|
return lower;
|
||||||
return value;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
ogg_sync_state oy; /// sync and verify incoming physical bitstream
|
ogg_sync_state oy; /// sync and verify incoming physical bitstream
|
||||||
|
|
|
@ -50,8 +50,8 @@ bool OpusDecoder::decode(msg::PcmChunk* chunk)
|
||||||
{
|
{
|
||||||
int frame_size = 0;
|
int frame_size = 0;
|
||||||
|
|
||||||
while ((frame_size = opus_decode(dec_, (unsigned char*)chunk->payload, chunk->payloadSize, pcm_.data(), pcm_.size() / sample_format_.channels(), 0)) ==
|
while ((frame_size = opus_decode(dec_, (unsigned char*)chunk->payload, chunk->payloadSize, pcm_.data(),
|
||||||
OPUS_BUFFER_TOO_SMALL)
|
static_cast<int>(pcm_.size()) / sample_format_.channels(), 0)) == OPUS_BUFFER_TOO_SMALL)
|
||||||
{
|
{
|
||||||
if (pcm_.size() < const_max_frame_size * sample_format_.channels())
|
if (pcm_.size() < const_max_frame_size * sample_format_.channels())
|
||||||
{
|
{
|
||||||
|
|
|
@ -51,7 +51,7 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Median as mean over N values around the median
|
/// Median as mean over N values around the median
|
||||||
T median(unsigned int mean = 1) const
|
T median(uint16_t mean = 1) const
|
||||||
{
|
{
|
||||||
if (buffer.empty())
|
if (buffer.empty())
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -61,12 +61,12 @@ public:
|
||||||
return tmpBuffer[tmpBuffer.size() / 2];
|
return tmpBuffer[tmpBuffer.size() / 2];
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
unsigned int low = tmpBuffer.size() / 2;
|
uint16_t low = static_cast<uint16_t>(tmpBuffer.size()) / 2;
|
||||||
unsigned int high = low;
|
uint16_t high = low;
|
||||||
low -= mean / 2;
|
low -= mean / 2;
|
||||||
high += mean / 2;
|
high += mean / 2;
|
||||||
T result((T)0);
|
T result((T)0);
|
||||||
for (unsigned int i = low; i <= high; ++i)
|
for (uint16_t i = low; i <= high; ++i)
|
||||||
{
|
{
|
||||||
result += tmpBuffer[i];
|
result += tmpBuffer[i];
|
||||||
}
|
}
|
||||||
|
|
|
@ -56,7 +56,7 @@ protected:
|
||||||
{
|
{
|
||||||
T* bufferT = (T*)buffer;
|
T* bufferT = (T*)buffer;
|
||||||
for (size_t n = 0; n < count; ++n)
|
for (size_t n = 0; n < count; ++n)
|
||||||
bufferT[n] = endian::swap<T>(endian::swap<T>(bufferT[n]) * volume);
|
bufferT[n] = endian::swap<T>(static_cast<T>(endian::swap<T>(bufferT[n]) * volume));
|
||||||
}
|
}
|
||||||
|
|
||||||
void adjustVolume(char* buffer, size_t frames);
|
void adjustVolume(char* buffer, size_t frames);
|
||||||
|
|
|
@ -50,7 +50,7 @@ void TimeProvider::setDiffToServer(double ms)
|
||||||
}
|
}
|
||||||
lastTimeSync = now.tv_sec;
|
lastTimeSync = now.tv_sec;
|
||||||
|
|
||||||
diffBuffer_.add(ms * 1000);
|
diffBuffer_.add(static_cast<chronos::usec::rep>(ms * 1000));
|
||||||
diffToServer_ = diffBuffer_.median();
|
diffToServer_ = diffBuffer_.median();
|
||||||
// LOG(INFO) << "setDiffToServer: " << ms << ", diff: " << diffToServer_ / 1000000 << " s, " << (diffToServer_ / 1000) % 1000 << "." << diffToServer_ % 1000
|
// LOG(INFO) << "setDiffToServer: " << ms << ", diff: " << diffToServer_ / 1000000 << " s, " << (diffToServer_ / 1000) % 1000 << "." << diffToServer_ % 1000
|
||||||
// << " ms\n";
|
// << " ms\n";
|
||||||
|
|
|
@ -30,7 +30,7 @@ namespace msg
|
||||||
class CodecHeader : public BaseMessage
|
class CodecHeader : public BaseMessage
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CodecHeader(const std::string& codecName = "", size_t size = 0)
|
CodecHeader(const std::string& codecName = "", uint32_t size = 0)
|
||||||
: BaseMessage(message_type::kCodecHeader), payloadSize(size), payload(nullptr), codec(codecName)
|
: BaseMessage(message_type::kCodecHeader), payloadSize(size), payload(nullptr), codec(codecName)
|
||||||
{
|
{
|
||||||
if (size > 0)
|
if (size > 0)
|
||||||
|
|
|
@ -36,7 +36,7 @@ namespace msg
|
||||||
class PcmChunk : public WireChunk
|
class PcmChunk : public WireChunk
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
PcmChunk(const SampleFormat& sampleFormat, size_t ms)
|
PcmChunk(const SampleFormat& sampleFormat, uint32_t ms)
|
||||||
: WireChunk((sampleFormat.rate() * ms / 1000) * sampleFormat.frameSize()), format(sampleFormat), idx_(0)
|
: WireChunk((sampleFormat.rate() * ms / 1000) * sampleFormat.frameSize()), format(sampleFormat), idx_(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
|
@ -53,8 +53,8 @@ inline static void timeofday(struct timeval* tv)
|
||||||
{
|
{
|
||||||
auto now = Clock::now();
|
auto now = Clock::now();
|
||||||
auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(now.time_since_epoch());
|
auto microsecs = std::chrono::duration_cast<std::chrono::microseconds>(now.time_since_epoch());
|
||||||
tv->tv_sec = static_cast<time_t>(microsecs.count() / 1000000);
|
tv->tv_sec = static_cast<long>(microsecs.count() / 1000000);
|
||||||
tv->tv_usec = static_cast<suseconds_t>(microsecs.count() % 1000000);
|
tv->tv_usec = static_cast<long>(microsecs.count() % 1000000);
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef WINDOWS
|
#ifdef WINDOWS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue