Merge remote-tracking branch 'origin/master'

This commit is contained in:
Dmytro Bogovych 2024-10-24 12:29:43 +03:00
commit 62e4828241
3 changed files with 666 additions and 661 deletions

View File

@ -16,6 +16,7 @@
#define stricmp strcasecmp #define stricmp strcasecmp
#endif #endif
#include <cstdint>
class strx class strx
{ {

View File

@ -494,7 +494,11 @@ int OpusCodec::encode(const void* input, int inputBytes, void* output, int outpu
int OpusCodec::decode(const void* input, int inputBytes, void* output, int outputCapacity) int OpusCodec::decode(const void* input, int inputBytes, void* output, int outputCapacity)
{ {
int nr_of_channels = opus_packet_get_nb_channels((const unsigned char*)input); int nr_of_channels = opus_packet_get_nb_channels((const unsigned char*)input);
assert(nr_of_channels == channels()); if (nr_of_channels != channels())
{
// Most probably bad configuration
return 0;
}
int nr_of_frames = opus_decoder_get_nb_samples(mDecoderCtx, (const unsigned char*)input, inputBytes); int nr_of_frames = opus_decoder_get_nb_samples(mDecoderCtx, (const unsigned char*)input, inputBytes);
if (nr_of_frames > 0) if (nr_of_frames > 0)
@ -538,7 +542,7 @@ int OpusCodec::plc(int lostFrames, void* output, int outputCapacity)
#define ILBC_CODEC_NAME "ILBC" #define ILBC_CODEC_NAME "ILBC"
IlbcCodec::IlbcCodec(int packetTime) IlbcCodec::IlbcCodec(int packetTime)
:mPacketTime(packetTime), mEncoderCtx(nullptr), mDecoderCtx(nullptr) :mPacketTime(packetTime), mEncoderCtx(nullptr), mDecoderCtx(nullptr)
{ {
WebRtcIlbcfix_EncoderCreate(&mEncoderCtx); WebRtcIlbcfix_EncoderCreate(&mEncoderCtx);
WebRtcIlbcfix_DecoderCreate(&mDecoderCtx); WebRtcIlbcfix_DecoderCreate(&mDecoderCtx);
@ -720,7 +724,7 @@ int IlbcCodec::IlbcFactory::processSdp(const resip::SdpContents::Session::Medium
#define ISAC_CODEC_NAME "ISAC" #define ISAC_CODEC_NAME "ISAC"
IsacCodec::IsacCodec(int samplerate) IsacCodec::IsacCodec(int samplerate)
:mSamplerate(samplerate) :mSamplerate(samplerate)
{ {
// This code initializes isac encoder to automatic mode - it will adjust its bitrate automatically. // This code initializes isac encoder to automatic mode - it will adjust its bitrate automatically.
// Frame time is 60 ms // Frame time is 60 ms
@ -860,7 +864,7 @@ PCodec IsacCodec::IsacFactory32K::create()
#define ALAW_CODEC_NAME "PCMA" #define ALAW_CODEC_NAME "PCMA"
G711Codec::G711Codec(int type) G711Codec::G711Codec(int type)
:mType(type) :mType(type)
{ {
} }

View File

@ -116,7 +116,7 @@ CodecList::Settings::OpusSpec CodecList::Settings::OpusSpec::parse(const std::st
{ {
OpusSpec result; OpusSpec result;
auto parts = strx::split(spec, "-"); auto parts = strx::split(spec, "-/");
if (parts.size() == 3) if (parts.size() == 3)
{ {
result.mPayloadType = strx::toInt(strx::trim(parts.front()).c_str(), -1); result.mPayloadType = strx::toInt(strx::trim(parts.front()).c_str(), -1);