- forgotten fixes from March
This commit is contained in:
parent
762eb9ca33
commit
0d69c26a13
|
|
@ -1,6 +1,7 @@
|
||||||
|
#include "HL_CrashRpt.h"
|
||||||
|
|
||||||
#if defined(USE_CRASHRPT)
|
#if defined(USE_CRASHRPT)
|
||||||
|
|
||||||
#include "HL_CrashRpt.h"
|
|
||||||
#include "HL_String.h"
|
#include "HL_String.h"
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -171,4 +172,22 @@ CrashReporterGuard::~CrashReporterGuard()
|
||||||
CrashReporter::free();
|
CrashReporter::free();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
|
||||||
|
CrashReporterThreadPoint::CrashReporterThreadPoint()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CrashReporterThreadPoint::~CrashReporterThreadPoint()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CrashReporterGuard::CrashReporterGuard()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
CrashReporterGuard::~CrashReporterGuard()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,9 @@ bool CsvReader::readLine(std::vector<std::string>& cells)
|
||||||
std::string line;
|
std::string line;
|
||||||
if (!std::getline(mInputStream, line))
|
if (!std::getline(mInputStream, line))
|
||||||
return false;
|
return false;
|
||||||
|
StringHelper::trim(line);
|
||||||
|
if (line.empty())
|
||||||
|
return false;
|
||||||
|
|
||||||
StringHelper::split(line, cells, ",;");
|
StringHelper::split(line, cells, ",;");
|
||||||
return true;
|
return true;
|
||||||
|
|
|
||||||
|
|
@ -202,7 +202,6 @@ std::shared_ptr<std::thread> OsProcess::asyncExecCommand(const std::string& cmdl
|
||||||
std::string OsProcess::execCommand(const std::string& cmd)
|
std::string OsProcess::execCommand(const std::string& cmd)
|
||||||
{
|
{
|
||||||
std::string cp = cmd;
|
std::string cp = cmd;
|
||||||
|
|
||||||
std::shared_ptr<FILE> pipe(popen(cp.c_str(), "r"), pclose);
|
std::shared_ptr<FILE> pipe(popen(cp.c_str(), "r"), pclose);
|
||||||
if (!pipe)
|
if (!pipe)
|
||||||
throw std::runtime_error("Failed to run.");
|
throw std::runtime_error("Failed to run.");
|
||||||
|
|
|
||||||
|
|
@ -276,8 +276,8 @@ float StringHelper::toFloat(const std::string &s, float v, bool* isOk)
|
||||||
|
|
||||||
std::string StringHelper::trim(const std::string &s)
|
std::string StringHelper::trim(const std::string &s)
|
||||||
{
|
{
|
||||||
auto wsfront = std::find_if_not(s.begin(), s.end(), [](int c) { return std::isspace(c); });
|
auto wsfront = std::find_if_not(s.begin(), s.end(), [](int c) { return std::isspace(c) || c == '\r' || c == '\n'; });
|
||||||
auto wsback = std::find_if_not(s.rbegin(), s.rend(), [](int c) { return std::isspace(c); }).base();
|
auto wsback = std::find_if_not(s.rbegin(), s.rend(), [](int c) { return std::isspace(c) || c == '\r' || c == '\n'; }).base();
|
||||||
return (wsback <= wsfront ? std::string() : std::string(wsfront,wsback));
|
return (wsback <= wsfront ? std::string() : std::string(wsfront,wsback));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,8 +17,8 @@
|
||||||
|
|
||||||
extern "C"
|
extern "C"
|
||||||
{
|
{
|
||||||
#include "libgsm/gsm.h"
|
#include "libgsm/gsm.h"
|
||||||
#include "g722/g722.h"
|
#include "g722/g722.h"
|
||||||
}
|
}
|
||||||
|
|
||||||
#include "libg729/g729_typedef.h"
|
#include "libg729/g729_typedef.h"
|
||||||
|
|
@ -28,27 +28,27 @@ extern "C"
|
||||||
|
|
||||||
namespace MT
|
namespace MT
|
||||||
{
|
{
|
||||||
class G729Codec: public Codec
|
class G729Codec: public Codec
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
CodState* mEncoder = nullptr;
|
CodState* mEncoder = nullptr;
|
||||||
DecState* mDecoder = nullptr;
|
DecState* mDecoder = nullptr;
|
||||||
void decodeFrame(const uint8_t* rtp, int16_t* pcm);
|
void decodeFrame(const uint8_t* rtp, int16_t* pcm);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class G729Factory: public Factory
|
class G729Factory: public Factory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const char* name() override;
|
const char* name() override;
|
||||||
int channels() override;
|
int channels() override;
|
||||||
int samplerate() override;
|
int samplerate() override;
|
||||||
int payloadType() override;
|
int payloadType() override;
|
||||||
|
|
||||||
#if defined(USE_RESIP_INTEGRATION)
|
#if defined(USE_RESIP_INTEGRATION)
|
||||||
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
||||||
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
||||||
#endif
|
#endif
|
||||||
PCodec create() override;
|
PCodec create() override;
|
||||||
};
|
};
|
||||||
G729Codec();
|
G729Codec();
|
||||||
~G729Codec() override;
|
~G729Codec() override;
|
||||||
|
|
@ -62,48 +62,48 @@ namespace MT
|
||||||
int encode(const void* input, int inputBytes, void* output, int outputCapacity) override;
|
int encode(const void* input, int inputBytes, void* output, int outputCapacity) override;
|
||||||
int decode(const void* input, int inputBytes, void* output, int outputCapacity) override;
|
int decode(const void* input, int inputBytes, void* output, int outputCapacity) override;
|
||||||
int plc(int lostFrames, void* output, int outputCapacity) override;
|
int plc(int lostFrames, void* output, int outputCapacity) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
class OpusCodec: public Codec
|
class OpusCodec: public Codec
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
OpusEncoder *mEncoderCtx;
|
OpusEncoder *mEncoderCtx;
|
||||||
OpusDecoder *mDecoderCtx;
|
OpusDecoder *mDecoderCtx;
|
||||||
int mPTime, mSamplerate, mChannels;
|
int mPTime, mSamplerate, mChannels;
|
||||||
Audio::SpeexResampler mDecodeResampler;
|
Audio::SpeexResampler mDecodeResampler;
|
||||||
public:
|
public:
|
||||||
struct Params
|
struct Params
|
||||||
{
|
{
|
||||||
bool mUseDtx, mUseInbandFec, mStereo;
|
bool mUseDtx, mUseInbandFec, mStereo;
|
||||||
int mPtime, mTargetBitrate, mExpectedPacketLoss;
|
int mPtime, mTargetBitrate, mExpectedPacketLoss;
|
||||||
|
|
||||||
Params();
|
Params();
|
||||||
#if defined(USE_RESIP_INTEGRATION)
|
#if defined(USE_RESIP_INTEGRATION)
|
||||||
resip::Data toString() const;
|
resip::Data toString() const;
|
||||||
void parse(const resip::Data& params);
|
void parse(const resip::Data& params);
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
|
|
||||||
class OpusFactory: public Factory
|
class OpusFactory: public Factory
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int mSamplerate, mChannels, mPType;
|
int mSamplerate, mChannels, mPType;
|
||||||
OpusCodec::Params mParams;
|
OpusCodec::Params mParams;
|
||||||
typedef std::vector<PCodec> CodecList;
|
typedef std::vector<PCodec> CodecList;
|
||||||
CodecList mCodecList;
|
CodecList mCodecList;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
OpusFactory(int samplerate, int channels, int ptype);
|
OpusFactory(int samplerate, int channels, int ptype);
|
||||||
|
|
||||||
const char* name() override;
|
const char* name() override;
|
||||||
int channels() override;
|
int channels() override;
|
||||||
int samplerate() override;
|
int samplerate() override;
|
||||||
int payloadType() override;
|
int payloadType() override;
|
||||||
#if defined(USE_RESIP_INTEGRATION)
|
#if defined(USE_RESIP_INTEGRATION)
|
||||||
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
||||||
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction) override;
|
||||||
#endif
|
#endif
|
||||||
PCodec create() override;
|
PCodec create() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
OpusCodec(int samplerate, int channels, int ptime);
|
OpusCodec(int samplerate, int channels, int ptime);
|
||||||
|
|
@ -119,34 +119,34 @@ namespace MT
|
||||||
int encode(const void* input, int inputBytes, void* output, int outputCapacity);
|
int encode(const void* input, int inputBytes, void* output, int outputCapacity);
|
||||||
int decode(const void* input, int inputBytes, void* output, int outputCapacity);
|
int decode(const void* input, int inputBytes, void* output, int outputCapacity);
|
||||||
int plc(int lostFrames, void* output, int outputCapacity);
|
int plc(int lostFrames, void* output, int outputCapacity);
|
||||||
};
|
};
|
||||||
|
|
||||||
class IlbcCodec: public Codec
|
class IlbcCodec: public Codec
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int mPacketTime; /// Single frame time (20 or 30 ms)
|
int mPacketTime; /// Single frame time (20 or 30 ms)
|
||||||
iLBC_encinst_t* mEncoderCtx;
|
iLBC_encinst_t* mEncoderCtx;
|
||||||
iLBC_decinst_t* mDecoderCtx;
|
iLBC_decinst_t* mDecoderCtx;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class IlbcFactory: public Factory
|
class IlbcFactory: public Factory
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int mPtime;
|
int mPtime;
|
||||||
int mPType20ms, mPType30ms;
|
int mPType20ms, mPType30ms;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
IlbcFactory(int ptype20ms, int ptype30ms);
|
IlbcFactory(int ptype20ms, int ptype30ms);
|
||||||
const char* name();
|
const char* name();
|
||||||
int samplerate();
|
int samplerate();
|
||||||
int payloadType();
|
int payloadType();
|
||||||
#if defined(USE_RESIP_INTEGRATION)
|
#if defined(USE_RESIP_INTEGRATION)
|
||||||
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
|
void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
|
||||||
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
|
int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
|
||||||
void create(CodecMap& codecs);
|
void create(CodecMap& codecs);
|
||||||
#endif
|
#endif
|
||||||
PCodec create();
|
PCodec create();
|
||||||
};
|
};
|
||||||
|
|
||||||
IlbcCodec(int packetTime);
|
IlbcCodec(int packetTime);
|
||||||
|
|
@ -159,33 +159,33 @@ namespace MT
|
||||||
int encode(const void* input, int inputBytes, void* output, int outputCapacity);
|
int encode(const void* input, int inputBytes, void* output, int outputCapacity);
|
||||||
int decode(const void* input, int inputBytes, void* output, int outputCapacity);
|
int decode(const void* input, int inputBytes, void* output, int outputCapacity);
|
||||||
int plc(int lostFrames, void* output, int outputCapacity);
|
int plc(int lostFrames, void* output, int outputCapacity);
|
||||||
};
|
};
|
||||||
|
|
||||||
class G711Codec: public Codec
|
class G711Codec: public Codec
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class AlawFactory: public Factory
|
class AlawFactory: public Factory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const char* name();
|
const char* name();
|
||||||
int samplerate();
|
int samplerate();
|
||||||
int payloadType();
|
int payloadType();
|
||||||
PCodec create();
|
PCodec create();
|
||||||
};
|
};
|
||||||
|
|
||||||
class UlawFactory: public Factory
|
class UlawFactory: public Factory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
const char* name();
|
const char* name();
|
||||||
int samplerate();
|
int samplerate();
|
||||||
int payloadType();
|
int payloadType();
|
||||||
PCodec create();
|
PCodec create();
|
||||||
};
|
};
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
ALaw = 0, /// a-law codec type
|
ALaw = 0, /// a-law codec type
|
||||||
ULaw = 1 /// u-law codec type
|
ULaw = 1 /// u-law codec type
|
||||||
};
|
};
|
||||||
|
|
||||||
G711Codec(int type);
|
G711Codec(int type);
|
||||||
|
|
@ -201,42 +201,42 @@ namespace MT
|
||||||
int decode(const void* input, int inputBytes, void* output, int outputCapacity);
|
int decode(const void* input, int inputBytes, void* output, int outputCapacity);
|
||||||
int plc(int lostSamples, void* output, int outputCapacity);
|
int plc(int lostSamples, void* output, int outputCapacity);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int mType; /// Determines if it is u-law or a-law codec. Its value is ALaw or ULaw.
|
int mType; /// Determines if it is u-law or a-law codec. Its value is ALaw or ULaw.
|
||||||
};
|
};
|
||||||
|
|
||||||
class IsacCodec: public Codec
|
class IsacCodec: public Codec
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int mSamplerate;
|
int mSamplerate;
|
||||||
ISACFIX_MainStruct* mEncoderCtx;
|
ISACFIX_MainStruct* mEncoderCtx;
|
||||||
ISACFIX_MainStruct* mDecoderCtx;
|
ISACFIX_MainStruct* mDecoderCtx;
|
||||||
public:
|
public:
|
||||||
class IsacFactory16K: public Factory
|
class IsacFactory16K: public Factory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IsacFactory16K(int ptype);
|
IsacFactory16K(int ptype);
|
||||||
const char* name();
|
const char* name();
|
||||||
int samplerate();
|
int samplerate();
|
||||||
int payloadType();
|
int payloadType();
|
||||||
PCodec create();
|
PCodec create();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int mPType;
|
int mPType;
|
||||||
};
|
};
|
||||||
|
|
||||||
class IsacFactory32K: public Factory
|
class IsacFactory32K: public Factory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
IsacFactory32K(int ptype);
|
IsacFactory32K(int ptype);
|
||||||
|
|
||||||
const char* name();
|
const char* name();
|
||||||
int samplerate();
|
int samplerate();
|
||||||
int payloadType();
|
int payloadType();
|
||||||
PCodec create();
|
PCodec create();
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int mPType;
|
int mPType;
|
||||||
};
|
};
|
||||||
|
|
||||||
IsacCodec(int sampleRate);
|
IsacCodec(int sampleRate);
|
||||||
|
|
@ -251,63 +251,63 @@ namespace MT
|
||||||
int encode(const void* input, int inputBytes, void* output, int outputCapacity);
|
int encode(const void* input, int inputBytes, void* output, int outputCapacity);
|
||||||
int decode(const void* input, int inputBytes, void* output, int outputCapacity);
|
int decode(const void* input, int inputBytes, void* output, int outputCapacity);
|
||||||
int plc(int lostFrames, void* output, int outputCapacity);
|
int plc(int lostFrames, void* output, int outputCapacity);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/// GSM MIME name
|
|
||||||
#define GSM_MIME_NAME "gsm"
|
|
||||||
|
|
||||||
/// Optional GSM SIP attributes
|
/// GSM MIME name
|
||||||
#define GSM_SIP_ATTR ""
|
#define GSM_MIME_NAME "gsm"
|
||||||
|
|
||||||
/// GSM codec single frame time in milliseconds
|
/// Optional GSM SIP attributes
|
||||||
#define GSM_AUDIOFRAME_TIME 20
|
#define GSM_SIP_ATTR ""
|
||||||
|
|
||||||
/// GSM codec single RTP frame size in bytes
|
/// GSM codec single frame time in milliseconds
|
||||||
#define GSM_RTPFRAME_SIZE_33 33
|
#define GSM_AUDIOFRAME_TIME 20
|
||||||
#define GSM_RTPFRAME_SIZE_32 32
|
|
||||||
#define GSM_RTPFRAME_SIZE_31 31
|
|
||||||
|
|
||||||
/// GSM payload type
|
/// GSM codec single RTP frame size in bytes
|
||||||
#define GSM_PAYLOAD_TYPE 3
|
#define GSM_RTPFRAME_SIZE_33 33
|
||||||
|
#define GSM_RTPFRAME_SIZE_32 32
|
||||||
|
#define GSM_RTPFRAME_SIZE_31 31
|
||||||
|
|
||||||
/// GSM bitrate (bits/sec)
|
/// GSM payload type
|
||||||
#define GSM_BITRATE 13000
|
#define GSM_PAYLOAD_TYPE 3
|
||||||
|
|
||||||
|
/// GSM bitrate (bits/sec)
|
||||||
|
#define GSM_BITRATE 13000
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
* GSM codec wrapper. Based on implementation located in libgsm directory.
|
* GSM codec wrapper. Based on implementation located in libgsm directory.
|
||||||
* @see IMediaCodec
|
* @see IMediaCodec
|
||||||
*/
|
*/
|
||||||
class GsmCodec: public Codec
|
class GsmCodec: public Codec
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
enum class Type
|
enum class Type
|
||||||
{
|
{
|
||||||
Bytes_33,
|
Bytes_33,
|
||||||
Bytes_32,
|
Bytes_32,
|
||||||
Bytes_31,
|
Bytes_31,
|
||||||
Bytes_65
|
Bytes_65
|
||||||
};
|
};
|
||||||
protected:
|
protected:
|
||||||
struct gsm_state * mGSM; /// Pointer to codec context
|
struct gsm_state * mGSM; /// Pointer to codec context
|
||||||
Type mCodecType;
|
Type mCodecType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class GsmFactory: public Factory
|
class GsmFactory: public Factory
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int mPayloadType;
|
int mPayloadType;
|
||||||
Type mCodecType;
|
Type mCodecType;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GsmFactory(Type codecType = Type::Bytes_33, int pt = GSM_PAYLOAD_TYPE);
|
GsmFactory(Type codecType = Type::Bytes_33, int pt = GSM_PAYLOAD_TYPE);
|
||||||
|
|
||||||
const char* name();
|
const char* name();
|
||||||
int samplerate();
|
int samplerate();
|
||||||
int payloadType();
|
int payloadType();
|
||||||
PCodec create();
|
PCodec create();
|
||||||
};
|
};
|
||||||
|
|
||||||
/*! Default constructor. Initializes codec context's pointer to NULL. */
|
/*! Default constructor. Initializes codec context's pointer to NULL. */
|
||||||
|
|
@ -325,42 +325,42 @@ namespace MT
|
||||||
int encode(const void* input, int inputBytes, void* output, int outputCapacity);
|
int encode(const void* input, int inputBytes, void* output, int outputCapacity);
|
||||||
int decode(const void* input, int inputBytes, void* output, int outputCapacity);
|
int decode(const void* input, int inputBytes, void* output, int outputCapacity);
|
||||||
int plc(int lostFrames, void* output, int outputCapacity);
|
int plc(int lostFrames, void* output, int outputCapacity);
|
||||||
};
|
};
|
||||||
|
|
||||||
/// GSM MIME name
|
/// GSM MIME name
|
||||||
#define G722_MIME_NAME "g722"
|
#define G722_MIME_NAME "g722"
|
||||||
|
|
||||||
/// Optional GSM SIP attributes
|
/// Optional GSM SIP attributes
|
||||||
#define G722_SIP_ATTR ""
|
#define G722_SIP_ATTR ""
|
||||||
|
|
||||||
/// GSM codec single frame time in milliseconds
|
/// GSM codec single frame time in milliseconds
|
||||||
#define G722_AUDIOFRAME_TIME 20
|
#define G722_AUDIOFRAME_TIME 20
|
||||||
|
|
||||||
/// GSM codec single RTP frame size in bytes
|
/// GSM codec single RTP frame size in bytes
|
||||||
#define G722_RTPFRAME_SIZE 80
|
#define G722_RTPFRAME_SIZE 80
|
||||||
|
|
||||||
/// GSM payload type
|
/// GSM payload type
|
||||||
#define G722_PAYLOAD_TYPE 9
|
#define G722_PAYLOAD_TYPE 9
|
||||||
|
|
||||||
/// GSM bitrate (bits/sec)
|
/// GSM bitrate (bits/sec)
|
||||||
#define G722_BITRATE 64000
|
#define G722_BITRATE 64000
|
||||||
|
|
||||||
class G722Codec: public Codec
|
class G722Codec: public Codec
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
void* mEncoder;
|
void* mEncoder;
|
||||||
void* mDecoder;
|
void* mDecoder;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class G722Factory: public Factory
|
class G722Factory: public Factory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
G722Factory();
|
G722Factory();
|
||||||
|
|
||||||
const char* name();
|
const char* name();
|
||||||
int samplerate();
|
int samplerate();
|
||||||
int payloadType();
|
int payloadType();
|
||||||
PCodec create();
|
PCodec create();
|
||||||
};
|
};
|
||||||
G722Codec();
|
G722Codec();
|
||||||
virtual ~G722Codec();
|
virtual ~G722Codec();
|
||||||
|
|
@ -376,26 +376,26 @@ namespace MT
|
||||||
int plc(int lostFrames, void* output, int outputCapacity);
|
int plc(int lostFrames, void* output, int outputCapacity);
|
||||||
|
|
||||||
//unsigned GetSamplerate() { return 16000; }
|
//unsigned GetSamplerate() { return 16000; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class GsmHrCodec: public Codec
|
class GsmHrCodec: public Codec
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
void* mDecoder;
|
void* mDecoder;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
class GsmHrFactory: public Factory
|
class GsmHrFactory: public Factory
|
||||||
{
|
{
|
||||||
protected:
|
protected:
|
||||||
int mPtype;
|
int mPtype;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
GsmHrFactory(int ptype);
|
GsmHrFactory(int ptype);
|
||||||
|
|
||||||
const char* name() override;
|
const char* name() override;
|
||||||
int samplerate() override;
|
int samplerate() override;
|
||||||
int payloadType() override;
|
int payloadType() override;
|
||||||
PCodec create() override;
|
PCodec create() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
GsmHrCodec();
|
GsmHrCodec();
|
||||||
|
|
@ -410,7 +410,7 @@ namespace MT
|
||||||
int encode(const void* input, int inputBytes, void* output, int outputCapacity) override;
|
int encode(const void* input, int inputBytes, void* output, int outputCapacity) override;
|
||||||
int decode(const void* input, int inputBytes, void* output, int outputCapacity) override;
|
int decode(const void* input, int inputBytes, void* output, int outputCapacity) override;
|
||||||
int plc(int lostFrames, void* output, int outputCapacity) override;
|
int plc(int lostFrames, void* output, int outputCapacity) override;
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -16,33 +16,33 @@
|
||||||
|
|
||||||
namespace MT
|
namespace MT
|
||||||
{
|
{
|
||||||
class Codec;
|
class Codec;
|
||||||
typedef std::shared_ptr<Codec> PCodec;
|
typedef std::shared_ptr<Codec> PCodec;
|
||||||
|
|
||||||
class CodecMap: public std::map<int, PCodec>
|
class CodecMap: public std::map<int, PCodec>
|
||||||
{
|
{
|
||||||
};
|
};
|
||||||
|
|
||||||
class Codec
|
class Codec
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
class Factory
|
class Factory
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
virtual ~Factory() {}
|
virtual ~Factory() {}
|
||||||
virtual const char* name() = 0;
|
virtual const char* name() = 0;
|
||||||
virtual int samplerate() = 0;
|
virtual int samplerate() = 0;
|
||||||
virtual int payloadType() = 0;
|
virtual int payloadType() = 0;
|
||||||
virtual PCodec create() = 0;
|
virtual PCodec create() = 0;
|
||||||
|
|
||||||
virtual int channels();
|
virtual int channels();
|
||||||
#if defined(USE_RESIP_INTEGRATION)
|
#if defined(USE_RESIP_INTEGRATION)
|
||||||
typedef std::map<int, PCodec > CodecMap;
|
typedef std::map<int, PCodec > CodecMap;
|
||||||
virtual void create(CodecMap& codecs);
|
virtual void create(CodecMap& codecs);
|
||||||
virtual void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
|
virtual void updateSdp(resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
|
||||||
// Returns payload type from chosen codec if success. -1 is returned for negative result.
|
// Returns payload type from chosen codec if success. -1 is returned for negative result.
|
||||||
virtual int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
|
virtual int processSdp(const resip::SdpContents::Session::Medium::CodecContainer& codecs, SdpDirection direction);
|
||||||
resip::Codec resipCodec();
|
resip::Codec resipCodec();
|
||||||
#endif
|
#endif
|
||||||
};
|
};
|
||||||
virtual ~Codec() {}
|
virtual ~Codec() {}
|
||||||
|
|
@ -59,6 +59,6 @@ namespace MT
|
||||||
|
|
||||||
// Returns size of codec in memory
|
// Returns size of codec in memory
|
||||||
virtual int getSize() const { return 0; };
|
virtual int getSize() const { return 0; };
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
|
|
@ -19,41 +19,41 @@
|
||||||
|
|
||||||
namespace MT
|
namespace MT
|
||||||
{
|
{
|
||||||
class CodecList
|
class CodecList
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
struct Settings
|
struct Settings
|
||||||
{
|
{
|
||||||
bool mWrapIuUP = false;
|
bool mWrapIuUP = false;
|
||||||
bool mSkipDecode = false;
|
bool mSkipDecode = false;
|
||||||
|
|
||||||
// AMR payload types
|
// AMR payload types
|
||||||
std::set<int> mAmrWbPayloadType = { MT_AMRWB_PAYLOADTYPE };
|
std::set<int> mAmrWbPayloadType = { MT_AMRWB_PAYLOADTYPE };
|
||||||
std::set<int> mAmrNbPayloadType = { MT_AMRNB_PAYLOADTYPE };
|
std::set<int> mAmrNbPayloadType = { MT_AMRNB_PAYLOADTYPE };
|
||||||
std::set<int> mAmrWbOctetPayloadType = { MT_AMRWB_OCTET_PAYLOADTYPE };
|
std::set<int> mAmrWbOctetPayloadType = { MT_AMRWB_OCTET_PAYLOADTYPE };
|
||||||
std::set<int> mAmrNbOctetPayloadType = { MT_AMRNB_OCTET_PAYLOADTYPE };
|
std::set<int> mAmrNbOctetPayloadType = { MT_AMRNB_OCTET_PAYLOADTYPE };
|
||||||
|
|
||||||
bool isAmrWb(int ptype) const { return mAmrWbOctetPayloadType.count(ptype) > 0 || mAmrWbPayloadType.count(ptype) > 0; }
|
bool isAmrWb(int ptype) const { return mAmrWbOctetPayloadType.count(ptype) > 0 || mAmrWbPayloadType.count(ptype) > 0; }
|
||||||
bool isAmrNb(int ptype) const { return mAmrNbOctetPayloadType.count(ptype) > 0 || mAmrNbPayloadType.count(ptype) > 0; }
|
bool isAmrNb(int ptype) const { return mAmrNbOctetPayloadType.count(ptype) > 0 || mAmrNbPayloadType.count(ptype) > 0; }
|
||||||
|
|
||||||
int mIsac16KPayloadType = MT_ISAC16K_PAYLOADTYPE;
|
int mIsac16KPayloadType = MT_ISAC16K_PAYLOADTYPE;
|
||||||
int mIsac32KPayloadType = MT_ISAC32K_PAYLOADTYPE;
|
int mIsac32KPayloadType = MT_ISAC32K_PAYLOADTYPE;
|
||||||
int mIlbc20PayloadType = MT_ILBC20_PAYLOADTYPE;
|
int mIlbc20PayloadType = MT_ILBC20_PAYLOADTYPE;
|
||||||
int mIlbc30PayloadType = MT_ILBC30_PAYLOADTYPE;
|
int mIlbc30PayloadType = MT_ILBC30_PAYLOADTYPE;
|
||||||
int mGsmFrPayloadType = 3; // GSM is codec with fixed payload type. But sometimes it has to be overwritten.
|
int mGsmFrPayloadType = 3; // GSM is codec with fixed payload type. But sometimes it has to be overwritten.
|
||||||
int mGsmFrPayloadLength = 33; // Expected GSM payload length
|
int mGsmFrPayloadLength = 33; // Expected GSM payload length
|
||||||
int mGsmHrPayloadType = MT_GSMHR_PAYLOADTYPE;
|
int mGsmHrPayloadType = MT_GSMHR_PAYLOADTYPE;
|
||||||
int mGsmEfrPayloadType = MT_GSMEFR_PAYLOADTYPE;
|
int mGsmEfrPayloadType = MT_GSMEFR_PAYLOADTYPE;
|
||||||
|
|
||||||
struct OpusSpec
|
struct OpusSpec
|
||||||
{
|
{
|
||||||
int mPayloadType = 0;
|
int mPayloadType = 0;
|
||||||
int mRate = 0;
|
int mRate = 0;
|
||||||
int mChannels = 0;
|
int mChannels = 0;
|
||||||
};
|
};
|
||||||
std::vector<OpusSpec> mOpusSpec;
|
std::vector<OpusSpec> mOpusSpec;
|
||||||
|
|
||||||
static Settings DefaultSettings;
|
static Settings DefaultSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
CodecList(const Settings& settings);
|
CodecList(const Settings& settings);
|
||||||
|
|
@ -64,15 +64,15 @@ namespace MT
|
||||||
int findCodec(const std::string& name) const;
|
int findCodec(const std::string& name) const;
|
||||||
void fillCodecMap(CodecMap& cm);
|
void fillCodecMap(CodecMap& cm);
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
typedef std::vector<Codec::Factory*> FactoryList;
|
typedef std::vector<Codec::Factory*> FactoryList;
|
||||||
FactoryList mFactoryList;
|
FactoryList mFactoryList;
|
||||||
Settings mSettings;
|
Settings mSettings;
|
||||||
};
|
};
|
||||||
|
|
||||||
class CodecListPriority
|
class CodecListPriority
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
CodecListPriority();
|
CodecListPriority();
|
||||||
~CodecListPriority();
|
~CodecListPriority();
|
||||||
|
|
||||||
|
|
@ -80,16 +80,16 @@ namespace MT
|
||||||
int count(const CodecList& cl) const;
|
int count(const CodecList& cl) const;
|
||||||
Codec::Factory& codecAt(const CodecList& cl, int index) const;
|
Codec::Factory& codecAt(const CodecList& cl, int index) const;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
struct Item
|
struct Item
|
||||||
{
|
{
|
||||||
int mCodecIndex;
|
int mCodecIndex;
|
||||||
int mPriority;
|
int mPriority;
|
||||||
};
|
};
|
||||||
std::vector<Item> mPriorityList;
|
std::vector<Item> mPriorityList;
|
||||||
|
|
||||||
static bool isNegativePriority(const CodecListPriority::Item& item);
|
static bool isNegativePriority(const CodecListPriority::Item& item);
|
||||||
static bool compare(const Item& item1, const Item& item2);
|
static bool compare(const Item& item1, const Item& item2);
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue