mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-07 22:02:12 +08:00
codecs: add support for g726, rename PCMA & PCMU
GitLab: #694 Change-Id: I74e430b89db2831979b45a56a566d496e0b7936b
This commit is contained in:
@ -43,6 +43,9 @@ FFMPEGCONF += \
|
|||||||
--disable-muxers \
|
--disable-muxers \
|
||||||
--enable-muxer=rtp \
|
--enable-muxer=rtp \
|
||||||
--enable-muxer=g722 \
|
--enable-muxer=g722 \
|
||||||
|
--enable-muxer=g723_1 \
|
||||||
|
--enable-muxer=g726 \
|
||||||
|
--enable-muxer=g726le \
|
||||||
--enable-muxer=h263 \
|
--enable-muxer=h263 \
|
||||||
--enable-muxer=h264 \
|
--enable-muxer=h264 \
|
||||||
--enable-muxer=hevc \
|
--enable-muxer=hevc \
|
||||||
@ -67,6 +70,9 @@ FFMPEGCONF += \
|
|||||||
--enable-demuxer=wav \
|
--enable-demuxer=wav \
|
||||||
--enable-demuxer=ac3 \
|
--enable-demuxer=ac3 \
|
||||||
--enable-demuxer=g722 \
|
--enable-demuxer=g722 \
|
||||||
|
--enable-demuxer=g723_1 \
|
||||||
|
--enable-demuxer=g726 \
|
||||||
|
--enable-demuxer=g726le \
|
||||||
--enable-demuxer=pcm_mulaw \
|
--enable-demuxer=pcm_mulaw \
|
||||||
--enable-demuxer=pcm_alaw \
|
--enable-demuxer=pcm_alaw \
|
||||||
--enable-demuxer=pcm_s16be \
|
--enable-demuxer=pcm_s16be \
|
||||||
@ -89,6 +95,13 @@ FFMPEGCONF += \
|
|||||||
FFMPEGCONF += \
|
FFMPEGCONF += \
|
||||||
--enable-encoder=adpcm_g722 \
|
--enable-encoder=adpcm_g722 \
|
||||||
--enable-decoder=adpcm_g722 \
|
--enable-decoder=adpcm_g722 \
|
||||||
|
--enable-encoder=adpcm_g726 \
|
||||||
|
--enable-decoder=adpcm_g726 \
|
||||||
|
--enable-encoder=adpcm_g726le \
|
||||||
|
--enable-decoder=adpcm_g726le \
|
||||||
|
--enable-decoder=g729 \
|
||||||
|
--enable-encoder=g723_1 \
|
||||||
|
--enable-decoder=g723_1 \
|
||||||
--enable-encoder=rawvideo \
|
--enable-encoder=rawvideo \
|
||||||
--enable-decoder=rawvideo \
|
--enable-decoder=rawvideo \
|
||||||
--enable-encoder=libx264 \
|
--enable-encoder=libx264 \
|
||||||
|
@ -35,6 +35,7 @@ namespace jami {
|
|||||||
*/
|
*/
|
||||||
SystemCodecInfo::SystemCodecInfo(unsigned codecId,
|
SystemCodecInfo::SystemCodecInfo(unsigned codecId,
|
||||||
unsigned avcodecId,
|
unsigned avcodecId,
|
||||||
|
const std::string& longName,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const std::string& libName,
|
const std::string& libName,
|
||||||
MediaType mediaType,
|
MediaType mediaType,
|
||||||
@ -45,6 +46,7 @@ SystemCodecInfo::SystemCodecInfo(unsigned codecId,
|
|||||||
unsigned maxQuality)
|
unsigned maxQuality)
|
||||||
: id(codecId)
|
: id(codecId)
|
||||||
, avcodecId(avcodecId)
|
, avcodecId(avcodecId)
|
||||||
|
, longName(longName)
|
||||||
, name(name)
|
, name(name)
|
||||||
, libName(libName)
|
, libName(libName)
|
||||||
, codecType(codecType)
|
, codecType(codecType)
|
||||||
@ -62,6 +64,7 @@ SystemCodecInfo::~SystemCodecInfo() {}
|
|||||||
*/
|
*/
|
||||||
SystemAudioCodecInfo::SystemAudioCodecInfo(unsigned codecId,
|
SystemAudioCodecInfo::SystemAudioCodecInfo(unsigned codecId,
|
||||||
unsigned m_avcodecId,
|
unsigned m_avcodecId,
|
||||||
|
const std::string& longName,
|
||||||
const std::string& m_name,
|
const std::string& m_name,
|
||||||
const std::string& m_libName,
|
const std::string& m_libName,
|
||||||
CodecType m_type,
|
CodecType m_type,
|
||||||
@ -71,6 +74,7 @@ SystemAudioCodecInfo::SystemAudioCodecInfo(unsigned codecId,
|
|||||||
unsigned m_payloadType)
|
unsigned m_payloadType)
|
||||||
: SystemCodecInfo(codecId,
|
: SystemCodecInfo(codecId,
|
||||||
m_avcodecId,
|
m_avcodecId,
|
||||||
|
longName,
|
||||||
m_name,
|
m_name,
|
||||||
m_libName,
|
m_libName,
|
||||||
MEDIA_AUDIO,
|
MEDIA_AUDIO,
|
||||||
@ -83,9 +87,9 @@ SystemAudioCodecInfo::SystemAudioCodecInfo(unsigned codecId,
|
|||||||
SystemAudioCodecInfo::~SystemAudioCodecInfo() {}
|
SystemAudioCodecInfo::~SystemAudioCodecInfo() {}
|
||||||
|
|
||||||
std::map<std::string, std::string>
|
std::map<std::string, std::string>
|
||||||
SystemAudioCodecInfo::getCodecSpecifications()
|
SystemAudioCodecInfo::getCodecSpecifications() const
|
||||||
{
|
{
|
||||||
return {{DRing::Account::ConfProperties::CodecInfo::NAME, name},
|
return {{DRing::Account::ConfProperties::CodecInfo::NAME, longName},
|
||||||
{DRing::Account::ConfProperties::CodecInfo::TYPE,
|
{DRing::Account::ConfProperties::CodecInfo::TYPE,
|
||||||
(mediaType & MEDIA_AUDIO ? "AUDIO" : "VIDEO")},
|
(mediaType & MEDIA_AUDIO ? "AUDIO" : "VIDEO")},
|
||||||
{DRing::Account::ConfProperties::CodecInfo::BITRATE, std::to_string(bitrate)},
|
{DRing::Account::ConfProperties::CodecInfo::BITRATE, std::to_string(bitrate)},
|
||||||
@ -100,6 +104,7 @@ SystemAudioCodecInfo::getCodecSpecifications()
|
|||||||
*/
|
*/
|
||||||
SystemVideoCodecInfo::SystemVideoCodecInfo(unsigned codecId,
|
SystemVideoCodecInfo::SystemVideoCodecInfo(unsigned codecId,
|
||||||
unsigned m_avcodecId,
|
unsigned m_avcodecId,
|
||||||
|
const std::string& longName,
|
||||||
const std::string& m_name,
|
const std::string& m_name,
|
||||||
const std::string& m_libName,
|
const std::string& m_libName,
|
||||||
CodecType m_type,
|
CodecType m_type,
|
||||||
@ -111,6 +116,7 @@ SystemVideoCodecInfo::SystemVideoCodecInfo(unsigned codecId,
|
|||||||
unsigned m_profileId)
|
unsigned m_profileId)
|
||||||
: SystemCodecInfo(codecId,
|
: SystemCodecInfo(codecId,
|
||||||
m_avcodecId,
|
m_avcodecId,
|
||||||
|
longName,
|
||||||
m_name,
|
m_name,
|
||||||
m_libName,
|
m_libName,
|
||||||
MEDIA_VIDEO,
|
MEDIA_VIDEO,
|
||||||
@ -126,10 +132,10 @@ SystemVideoCodecInfo::SystemVideoCodecInfo(unsigned codecId,
|
|||||||
SystemVideoCodecInfo::~SystemVideoCodecInfo() {}
|
SystemVideoCodecInfo::~SystemVideoCodecInfo() {}
|
||||||
|
|
||||||
std::map<std::string, std::string>
|
std::map<std::string, std::string>
|
||||||
SystemVideoCodecInfo::getCodecSpecifications()
|
SystemVideoCodecInfo::getCodecSpecifications() const
|
||||||
{
|
{
|
||||||
return {
|
return {
|
||||||
{DRing::Account::ConfProperties::CodecInfo::NAME, name},
|
{DRing::Account::ConfProperties::CodecInfo::NAME, longName},
|
||||||
{DRing::Account::ConfProperties::CodecInfo::TYPE,
|
{DRing::Account::ConfProperties::CodecInfo::TYPE,
|
||||||
(mediaType & MEDIA_AUDIO ? "AUDIO" : "VIDEO")},
|
(mediaType & MEDIA_AUDIO ? "AUDIO" : "VIDEO")},
|
||||||
{DRing::Account::ConfProperties::CodecInfo::BITRATE, std::to_string(bitrate)},
|
{DRing::Account::ConfProperties::CodecInfo::BITRATE, std::to_string(bitrate)},
|
||||||
@ -169,9 +175,9 @@ AccountAudioCodecInfo::AccountAudioCodecInfo(const SystemAudioCodecInfo& sysCode
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
std::map<std::string, std::string>
|
std::map<std::string, std::string>
|
||||||
AccountAudioCodecInfo::getCodecSpecifications()
|
AccountAudioCodecInfo::getCodecSpecifications() const
|
||||||
{
|
{
|
||||||
return {{DRing::Account::ConfProperties::CodecInfo::NAME, systemCodecInfo.name},
|
return {{DRing::Account::ConfProperties::CodecInfo::NAME, systemCodecInfo.longName},
|
||||||
{DRing::Account::ConfProperties::CodecInfo::TYPE,
|
{DRing::Account::ConfProperties::CodecInfo::TYPE,
|
||||||
(systemCodecInfo.mediaType & MEDIA_AUDIO ? "AUDIO" : "VIDEO")},
|
(systemCodecInfo.mediaType & MEDIA_AUDIO ? "AUDIO" : "VIDEO")},
|
||||||
{DRing::Account::ConfProperties::CodecInfo::BITRATE, std::to_string(bitrate)},
|
{DRing::Account::ConfProperties::CodecInfo::BITRATE, std::to_string(bitrate)},
|
||||||
@ -208,9 +214,9 @@ AccountVideoCodecInfo::AccountVideoCodecInfo(const SystemVideoCodecInfo& sysCode
|
|||||||
{}
|
{}
|
||||||
|
|
||||||
std::map<std::string, std::string>
|
std::map<std::string, std::string>
|
||||||
AccountVideoCodecInfo::getCodecSpecifications()
|
AccountVideoCodecInfo::getCodecSpecifications() const
|
||||||
{
|
{
|
||||||
return {{DRing::Account::ConfProperties::CodecInfo::NAME, systemCodecInfo.name},
|
return {{DRing::Account::ConfProperties::CodecInfo::NAME, systemCodecInfo.longName},
|
||||||
{DRing::Account::ConfProperties::CodecInfo::TYPE,
|
{DRing::Account::ConfProperties::CodecInfo::TYPE,
|
||||||
(systemCodecInfo.mediaType & MEDIA_AUDIO ? "AUDIO" : "VIDEO")},
|
(systemCodecInfo.mediaType & MEDIA_AUDIO ? "AUDIO" : "VIDEO")},
|
||||||
{DRing::Account::ConfProperties::CodecInfo::BITRATE, std::to_string(bitrate)},
|
{DRing::Account::ConfProperties::CodecInfo::BITRATE, std::to_string(bitrate)},
|
||||||
|
@ -86,6 +86,7 @@ struct SystemCodecInfo
|
|||||||
|
|
||||||
SystemCodecInfo(unsigned codecId,
|
SystemCodecInfo(unsigned codecId,
|
||||||
unsigned avcodecId,
|
unsigned avcodecId,
|
||||||
|
const std::string& longName,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const std::string& libName,
|
const std::string& libName,
|
||||||
MediaType mediaType,
|
MediaType mediaType,
|
||||||
@ -99,8 +100,9 @@ struct SystemCodecInfo
|
|||||||
|
|
||||||
/* generic codec information */
|
/* generic codec information */
|
||||||
unsigned id; /* id of the codec used with dbus */
|
unsigned id; /* id of the codec used with dbus */
|
||||||
unsigned avcodecId; /* read as AVCodecID libav codec identifier */
|
unsigned avcodecId; /* AVCodecID libav codec identifier */
|
||||||
std::string name;
|
std::string longName; /* User-friendly codec name */
|
||||||
|
std::string name; /* RTP codec name as specified by http://www.iana.org/assignments/rtp-parameters/rtp-parameters.xhtml */
|
||||||
std::string libName;
|
std::string libName;
|
||||||
CodecType codecType;
|
CodecType codecType;
|
||||||
MediaType mediaType;
|
MediaType mediaType;
|
||||||
@ -123,6 +125,7 @@ struct SystemAudioCodecInfo : SystemCodecInfo
|
|||||||
{
|
{
|
||||||
SystemAudioCodecInfo(unsigned codecId,
|
SystemAudioCodecInfo(unsigned codecId,
|
||||||
unsigned avcodecId,
|
unsigned avcodecId,
|
||||||
|
const std::string& longName,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const std::string& libName,
|
const std::string& libName,
|
||||||
CodecType type,
|
CodecType type,
|
||||||
@ -133,7 +136,7 @@ struct SystemAudioCodecInfo : SystemCodecInfo
|
|||||||
|
|
||||||
~SystemAudioCodecInfo();
|
~SystemAudioCodecInfo();
|
||||||
|
|
||||||
std::map<std::string, std::string> getCodecSpecifications();
|
std::map<std::string, std::string> getCodecSpecifications() const;
|
||||||
|
|
||||||
AudioFormat audioformat {AudioFormat::NONE()};
|
AudioFormat audioformat {AudioFormat::NONE()};
|
||||||
};
|
};
|
||||||
@ -147,6 +150,7 @@ struct SystemVideoCodecInfo : SystemCodecInfo
|
|||||||
{
|
{
|
||||||
SystemVideoCodecInfo(unsigned codecId,
|
SystemVideoCodecInfo(unsigned codecId,
|
||||||
unsigned avcodecId,
|
unsigned avcodecId,
|
||||||
|
const std::string& longName,
|
||||||
const std::string& name,
|
const std::string& name,
|
||||||
const std::string& libName,
|
const std::string& libName,
|
||||||
CodecType type = CODEC_NONE,
|
CodecType type = CODEC_NONE,
|
||||||
@ -159,7 +163,7 @@ struct SystemVideoCodecInfo : SystemCodecInfo
|
|||||||
|
|
||||||
~SystemVideoCodecInfo();
|
~SystemVideoCodecInfo();
|
||||||
|
|
||||||
std::map<std::string, std::string> getCodecSpecifications();
|
std::map<std::string, std::string> getCodecSpecifications() const;
|
||||||
|
|
||||||
unsigned frameRate;
|
unsigned frameRate;
|
||||||
unsigned profileId;
|
unsigned profileId;
|
||||||
@ -186,14 +190,14 @@ struct AccountCodecInfo
|
|||||||
unsigned payloadType;
|
unsigned payloadType;
|
||||||
unsigned bitrate;
|
unsigned bitrate;
|
||||||
unsigned quality;
|
unsigned quality;
|
||||||
std::map<std::string, std::string> getCodecSpecifications();
|
std::map<std::string, std::string> getCodecSpecifications() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct AccountAudioCodecInfo : AccountCodecInfo
|
struct AccountAudioCodecInfo : AccountCodecInfo
|
||||||
{
|
{
|
||||||
AccountAudioCodecInfo(const SystemAudioCodecInfo& sysCodecInfo);
|
AccountAudioCodecInfo(const SystemAudioCodecInfo& sysCodecInfo);
|
||||||
|
|
||||||
std::map<std::string, std::string> getCodecSpecifications();
|
std::map<std::string, std::string> getCodecSpecifications() const;
|
||||||
void setCodecSpecifications(const std::map<std::string, std::string>& details);
|
void setCodecSpecifications(const std::map<std::string, std::string>& details);
|
||||||
|
|
||||||
/* account custom values */
|
/* account custom values */
|
||||||
@ -206,7 +210,7 @@ struct AccountVideoCodecInfo : AccountCodecInfo
|
|||||||
AccountVideoCodecInfo(const SystemVideoCodecInfo& sysCodecInfo);
|
AccountVideoCodecInfo(const SystemVideoCodecInfo& sysCodecInfo);
|
||||||
|
|
||||||
void setCodecSpecifications(const std::map<std::string, std::string>& details);
|
void setCodecSpecifications(const std::map<std::string, std::string>& details);
|
||||||
std::map<std::string, std::string> getCodecSpecifications();
|
std::map<std::string, std::string> getCodecSpecifications() const;
|
||||||
|
|
||||||
/* account custom values */
|
/* account custom values */
|
||||||
unsigned frameRate;
|
unsigned frameRate;
|
||||||
|
@ -64,6 +64,7 @@ SystemCodecContainer::initCodecConfig()
|
|||||||
/* Define supported video codec*/
|
/* Define supported video codec*/
|
||||||
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_HEVC,
|
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_HEVC,
|
||||||
AV_CODEC_ID_HEVC,
|
AV_CODEC_ID_HEVC,
|
||||||
|
"H.265/HEVC",
|
||||||
"H265",
|
"H265",
|
||||||
"",
|
"",
|
||||||
CODEC_ENCODER_DECODER,
|
CODEC_ENCODER_DECODER,
|
||||||
@ -73,6 +74,7 @@ SystemCodecContainer::initCodecConfig()
|
|||||||
|
|
||||||
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H264,
|
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H264,
|
||||||
AV_CODEC_ID_H264,
|
AV_CODEC_ID_H264,
|
||||||
|
"H.264/AVC",
|
||||||
"H264",
|
"H264",
|
||||||
"libx264",
|
"libx264",
|
||||||
CODEC_ENCODER_DECODER,
|
CODEC_ENCODER_DECODER,
|
||||||
@ -83,6 +85,7 @@ SystemCodecContainer::initCodecConfig()
|
|||||||
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_VP8,
|
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_VP8,
|
||||||
AV_CODEC_ID_VP8,
|
AV_CODEC_ID_VP8,
|
||||||
"VP8",
|
"VP8",
|
||||||
|
"VP8",
|
||||||
"libvpx",
|
"libvpx",
|
||||||
CODEC_ENCODER_DECODER,
|
CODEC_ENCODER_DECODER,
|
||||||
defaultBitrate,
|
defaultBitrate,
|
||||||
@ -92,12 +95,14 @@ SystemCodecContainer::initCodecConfig()
|
|||||||
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_MPEG4,
|
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_MPEG4,
|
||||||
AV_CODEC_ID_MPEG4,
|
AV_CODEC_ID_MPEG4,
|
||||||
"MP4V-ES",
|
"MP4V-ES",
|
||||||
|
"MP4V-ES",
|
||||||
"mpeg4",
|
"mpeg4",
|
||||||
CODEC_ENCODER_DECODER,
|
CODEC_ENCODER_DECODER,
|
||||||
defaultBitrate),
|
defaultBitrate),
|
||||||
|
|
||||||
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H263,
|
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H263,
|
||||||
AV_CODEC_ID_H263,
|
AV_CODEC_ID_H263,
|
||||||
|
"H.263",
|
||||||
"H263-1998",
|
"H263-1998",
|
||||||
"h263",
|
"h263",
|
||||||
CODEC_ENCODER_DECODER,
|
CODEC_ENCODER_DECODER,
|
||||||
@ -109,6 +114,7 @@ SystemCodecContainer::initCodecConfig()
|
|||||||
|
|
||||||
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_OPUS,
|
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_OPUS,
|
||||||
AV_CODEC_ID_OPUS,
|
AV_CODEC_ID_OPUS,
|
||||||
|
"Opus",
|
||||||
"opus",
|
"opus",
|
||||||
"libopus",
|
"libopus",
|
||||||
CODEC_ENCODER_DECODER,
|
CODEC_ENCODER_DECODER,
|
||||||
@ -119,6 +125,7 @@ SystemCodecContainer::initCodecConfig()
|
|||||||
|
|
||||||
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_ADPCM_G722,
|
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_ADPCM_G722,
|
||||||
AV_CODEC_ID_ADPCM_G722,
|
AV_CODEC_ID_ADPCM_G722,
|
||||||
|
"G.722",
|
||||||
"G722",
|
"G722",
|
||||||
"g722",
|
"g722",
|
||||||
CODEC_ENCODER_DECODER,
|
CODEC_ENCODER_DECODER,
|
||||||
@ -127,8 +134,20 @@ SystemCodecContainer::initCodecConfig()
|
|||||||
1,
|
1,
|
||||||
9),
|
9),
|
||||||
|
|
||||||
|
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_ADPCM_G726,
|
||||||
|
AV_CODEC_ID_ADPCM_G726,
|
||||||
|
"G.726",
|
||||||
|
"G726-32",
|
||||||
|
"g726",
|
||||||
|
CODEC_ENCODER_DECODER,
|
||||||
|
0,
|
||||||
|
8000,
|
||||||
|
1,
|
||||||
|
2),
|
||||||
|
|
||||||
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_SPEEX | 0x20000000,
|
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_SPEEX | 0x20000000,
|
||||||
AV_CODEC_ID_SPEEX,
|
AV_CODEC_ID_SPEEX,
|
||||||
|
"Speex",
|
||||||
"speex",
|
"speex",
|
||||||
"libspeex",
|
"libspeex",
|
||||||
CODEC_ENCODER_DECODER,
|
CODEC_ENCODER_DECODER,
|
||||||
@ -139,6 +158,7 @@ SystemCodecContainer::initCodecConfig()
|
|||||||
|
|
||||||
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_SPEEX | 0x10000000,
|
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_SPEEX | 0x10000000,
|
||||||
AV_CODEC_ID_SPEEX,
|
AV_CODEC_ID_SPEEX,
|
||||||
|
"Speex",
|
||||||
"speex",
|
"speex",
|
||||||
"libspeex",
|
"libspeex",
|
||||||
CODEC_ENCODER_DECODER,
|
CODEC_ENCODER_DECODER,
|
||||||
@ -149,6 +169,7 @@ SystemCodecContainer::initCodecConfig()
|
|||||||
|
|
||||||
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_SPEEX,
|
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_SPEEX,
|
||||||
AV_CODEC_ID_SPEEX,
|
AV_CODEC_ID_SPEEX,
|
||||||
|
"Speex",
|
||||||
"speex",
|
"speex",
|
||||||
"libspeex",
|
"libspeex",
|
||||||
CODEC_ENCODER_DECODER,
|
CODEC_ENCODER_DECODER,
|
||||||
@ -159,6 +180,7 @@ SystemCodecContainer::initCodecConfig()
|
|||||||
|
|
||||||
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_PCM_ALAW,
|
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_PCM_ALAW,
|
||||||
AV_CODEC_ID_PCM_ALAW,
|
AV_CODEC_ID_PCM_ALAW,
|
||||||
|
"G.711a",
|
||||||
"PCMA",
|
"PCMA",
|
||||||
"pcm_alaw",
|
"pcm_alaw",
|
||||||
CODEC_ENCODER_DECODER,
|
CODEC_ENCODER_DECODER,
|
||||||
@ -169,6 +191,7 @@ SystemCodecContainer::initCodecConfig()
|
|||||||
|
|
||||||
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_PCM_MULAW,
|
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_PCM_MULAW,
|
||||||
AV_CODEC_ID_PCM_MULAW,
|
AV_CODEC_ID_PCM_MULAW,
|
||||||
|
"G.711u",
|
||||||
"PCMU",
|
"PCMU",
|
||||||
"pcm_mulaw",
|
"pcm_mulaw",
|
||||||
CODEC_ENCODER_DECODER,
|
CODEC_ENCODER_DECODER,
|
||||||
@ -203,28 +226,23 @@ SystemCodecContainer::setActiveH265()
|
|||||||
void
|
void
|
||||||
SystemCodecContainer::checkInstalledCodecs()
|
SystemCodecContainer::checkInstalledCodecs()
|
||||||
{
|
{
|
||||||
AVCodecID codecId;
|
std::ostringstream enc_ss;
|
||||||
std::string codecName;
|
std::ostringstream dec_ss;
|
||||||
CodecType codecType;
|
|
||||||
|
|
||||||
std::stringstream enc_ss;
|
|
||||||
std::stringstream dec_ss;
|
|
||||||
|
|
||||||
for (const auto& codecIt : availableCodecList_) {
|
for (const auto& codecIt : availableCodecList_) {
|
||||||
codecId = (AVCodecID) codecIt->avcodecId;
|
AVCodecID codecId = (AVCodecID) codecIt->avcodecId;
|
||||||
codecName = codecIt->name;
|
CodecType codecType = codecIt->codecType;
|
||||||
codecType = codecIt->codecType;
|
|
||||||
|
|
||||||
if (codecType & CODEC_ENCODER) {
|
if (codecType & CODEC_ENCODER) {
|
||||||
if (avcodec_find_encoder(codecId) != nullptr)
|
if (avcodec_find_encoder(codecId) != nullptr)
|
||||||
enc_ss << codecName << " ";
|
enc_ss << codecIt->name << ' ';
|
||||||
else
|
else
|
||||||
codecIt->codecType = (CodecType)((unsigned) codecType & ~CODEC_ENCODER);
|
codecIt->codecType = (CodecType)((unsigned) codecType & ~CODEC_ENCODER);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (codecType & CODEC_DECODER) {
|
if (codecType & CODEC_DECODER) {
|
||||||
if (avcodec_find_decoder(codecId) != nullptr)
|
if (avcodec_find_decoder(codecId) != nullptr)
|
||||||
dec_ss << codecName << " ";
|
dec_ss << codecIt->name << ' ';
|
||||||
else
|
else
|
||||||
codecIt->codecType = (CodecType)((unsigned) codecType & ~CODEC_DECODER);
|
codecIt->codecType = (CodecType)((unsigned) codecType & ~CODEC_DECODER);
|
||||||
}
|
}
|
||||||
|
@ -86,14 +86,13 @@ Sdp::~Sdp()
|
|||||||
}
|
}
|
||||||
|
|
||||||
std::shared_ptr<AccountCodecInfo>
|
std::shared_ptr<AccountCodecInfo>
|
||||||
Sdp::findCodecBySpec(const std::string& codec, const unsigned clockrate) const
|
Sdp::findCodecBySpec(std::string_view codec, const unsigned clockrate) const
|
||||||
{
|
{
|
||||||
// TODO : only manage a list?
|
// TODO : only manage a list?
|
||||||
for (const auto& accountCodec : audio_codec_list_) {
|
for (const auto& accountCodec : audio_codec_list_) {
|
||||||
auto audioCodecInfo = std::static_pointer_cast<AccountAudioCodecInfo>(accountCodec);
|
auto audioCodecInfo = std::static_pointer_cast<AccountAudioCodecInfo>(accountCodec);
|
||||||
auto& sysCodecInfo = *static_cast<const SystemAudioCodecInfo*>(
|
auto& sysCodecInfo = *static_cast<const SystemAudioCodecInfo*>(&audioCodecInfo->systemCodecInfo);
|
||||||
&audioCodecInfo->systemCodecInfo);
|
if (sysCodecInfo.name == codec
|
||||||
if (sysCodecInfo.name.compare(codec) == 0
|
|
||||||
and (audioCodecInfo->isPCMG722() ? (clockrate == 8000)
|
and (audioCodecInfo->isPCMG722() ? (clockrate == 8000)
|
||||||
: (sysCodecInfo.audioformat.sample_rate == clockrate)))
|
: (sysCodecInfo.audioformat.sample_rate == clockrate)))
|
||||||
return accountCodec;
|
return accountCodec;
|
||||||
@ -101,7 +100,7 @@ Sdp::findCodecBySpec(const std::string& codec, const unsigned clockrate) const
|
|||||||
|
|
||||||
for (const auto& accountCodec : video_codec_list_) {
|
for (const auto& accountCodec : video_codec_list_) {
|
||||||
auto sysCodecInfo = accountCodec->systemCodecInfo;
|
auto sysCodecInfo = accountCodec->systemCodecInfo;
|
||||||
if (sysCodecInfo.name.compare(codec) == 0)
|
if (sysCodecInfo.name == codec)
|
||||||
return accountCodec;
|
return accountCodec;
|
||||||
}
|
}
|
||||||
return nullptr;
|
return nullptr;
|
||||||
@ -112,13 +111,13 @@ Sdp::findCodecByPayload(const unsigned payloadType)
|
|||||||
{
|
{
|
||||||
// TODO : only manage a list?
|
// TODO : only manage a list?
|
||||||
for (const auto& accountCodec : audio_codec_list_) {
|
for (const auto& accountCodec : audio_codec_list_) {
|
||||||
auto sysCodecInfo = accountCodec->systemCodecInfo;
|
auto& sysCodecInfo = accountCodec->systemCodecInfo;
|
||||||
if (sysCodecInfo.payloadType == payloadType)
|
if (sysCodecInfo.payloadType == payloadType)
|
||||||
return accountCodec;
|
return accountCodec;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const auto& accountCodec : video_codec_list_) {
|
for (const auto& accountCodec : video_codec_list_) {
|
||||||
auto sysCodecInfo = accountCodec->systemCodecInfo;
|
auto& sysCodecInfo = accountCodec->systemCodecInfo;
|
||||||
if (sysCodecInfo.payloadType == payloadType)
|
if (sysCodecInfo.payloadType == payloadType)
|
||||||
return accountCodec;
|
return accountCodec;
|
||||||
}
|
}
|
||||||
@ -847,11 +846,11 @@ Sdp::getMediaDescriptions(const pjmedia_sdp_session* session, bool remote) const
|
|||||||
descr.enabled = false;
|
descr.enabled = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
const std::string codec_raw(rtpmap.enc_name.ptr, rtpmap.enc_name.slen);
|
auto codec_raw = sip_utils::as_view(rtpmap.enc_name);
|
||||||
descr.rtp_clockrate = rtpmap.clock_rate;
|
descr.rtp_clockrate = rtpmap.clock_rate;
|
||||||
descr.codec = findCodecBySpec(codec_raw, rtpmap.clock_rate);
|
descr.codec = findCodecBySpec(codec_raw, rtpmap.clock_rate);
|
||||||
if (not descr.codec) {
|
if (not descr.codec) {
|
||||||
JAMI_ERR("Could not find codec %s", codec_raw.c_str());
|
JAMI_ERR("Could not find codec %.*s", (int)codec_raw.size(), codec_raw.data());
|
||||||
descr.enabled = false;
|
descr.enabled = false;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -265,7 +265,7 @@ private:
|
|||||||
void addRTCPAttribute(pjmedia_sdp_media* med, uint16_t port);
|
void addRTCPAttribute(pjmedia_sdp_media* med, uint16_t port);
|
||||||
|
|
||||||
std::shared_ptr<AccountCodecInfo> findCodecByPayload(const unsigned payloadType);
|
std::shared_ptr<AccountCodecInfo> findCodecByPayload(const unsigned payloadType);
|
||||||
std::shared_ptr<AccountCodecInfo> findCodecBySpec(const std::string& codecName,
|
std::shared_ptr<AccountCodecInfo> findCodecBySpec(std::string_view codecName,
|
||||||
const unsigned clockrate = 0) const;
|
const unsigned clockrate = 0) const;
|
||||||
|
|
||||||
// Data members
|
// Data members
|
||||||
|
Reference in New Issue
Block a user