mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
daemon: define A/V bitrate and use it for encoding
Refs #68792 Change-Id: I42b94679fd3dc03926d5263b9e37dfd1d23d21f5 Signed-off-by: Guillaume Roguez <guillaume.roguez@savoirfairelinux.com>
This commit is contained in:

committed by
Guillaume Roguez

parent
406a0b523c
commit
d889b9f233
@ -116,10 +116,12 @@ SystemVideoCodecInfo::SystemVideoCodecInfo(unsigned m_avcodecId,
|
||||
const std::string m_name,
|
||||
std::string m_libName,
|
||||
CodecType m_type,
|
||||
unsigned m_bitrate,
|
||||
unsigned m_payloadType,
|
||||
unsigned m_frameRate,
|
||||
unsigned m_profileId)
|
||||
: SystemCodecInfo(m_avcodecId, m_name, m_libName, MEDIA_VIDEO, m_type, m_payloadType)
|
||||
: SystemCodecInfo(m_avcodecId, m_name, m_libName, MEDIA_VIDEO,
|
||||
m_type, m_bitrate, m_payloadType)
|
||||
, frameRate(m_frameRate), profileId(m_profileId)
|
||||
{}
|
||||
|
||||
|
@ -116,6 +116,7 @@ struct SystemVideoCodecInfo : SystemCodecInfo
|
||||
{
|
||||
SystemVideoCodecInfo(unsigned avcodecId, const std::string name,
|
||||
std::string libName, CodecType type = CODEC_NONE,
|
||||
unsigned bitrate = 0,
|
||||
unsigned payloadType = 0, unsigned frameRate = 0,
|
||||
unsigned profileId = 0);
|
||||
|
||||
|
@ -81,7 +81,7 @@ void MediaEncoder::setDeviceOptions(const DeviceParams& args)
|
||||
void MediaEncoder::setOptions(const MediaDescription& args)
|
||||
{
|
||||
av_dict_set(&options_, "payload_type", ring::to_string(args.payload_type).c_str(), 0);
|
||||
av_dict_set(&options_, "bitrate", ring::to_string(args.bitrate).c_str(), 0);
|
||||
av_dict_set(&options_, "bitrate", ring::to_string(args.codec->bitrate).c_str(), 0);
|
||||
|
||||
auto accountAudioCodec = std::static_pointer_cast<AccountAudioCodecInfo>(args.codec);
|
||||
if (accountAudioCodec->audioformat.sample_rate)
|
||||
|
@ -40,6 +40,8 @@ namespace ring {
|
||||
|
||||
decltype(getGlobalInstance<SystemCodecContainer>)& getSystemCodecContainer = getGlobalInstance<SystemCodecContainer>;
|
||||
|
||||
constexpr static auto DEFAULT_VIDEO_BITRATE = 400;
|
||||
|
||||
SystemCodecContainer::SystemCodecContainer()
|
||||
{
|
||||
initCodecConfig();
|
||||
@ -58,19 +60,23 @@ SystemCodecContainer::initCodecConfig()
|
||||
/* Define supported video codec*/
|
||||
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H264,
|
||||
"H264", "libx264",
|
||||
CODEC_ENCODER_DECODER),
|
||||
CODEC_ENCODER_DECODER,
|
||||
DEFAULT_VIDEO_BITRATE),
|
||||
|
||||
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H263,
|
||||
"H263", "h263",
|
||||
CODEC_ENCODER_DECODER),
|
||||
CODEC_ENCODER_DECODER,
|
||||
DEFAULT_VIDEO_BITRATE),
|
||||
|
||||
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_VP8,
|
||||
"VP8", "libvpx",
|
||||
CODEC_ENCODER_DECODER),
|
||||
CODEC_ENCODER_DECODER,
|
||||
DEFAULT_VIDEO_BITRATE),
|
||||
|
||||
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_MPEG4,
|
||||
"MP4V-ES", "mpeg4",
|
||||
CODEC_ENCODER_DECODER),
|
||||
CODEC_ENCODER_DECODER,
|
||||
DEFAULT_VIDEO_BITRATE),
|
||||
#endif
|
||||
/* Define supported audio codec*/
|
||||
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_PCM_ALAW,
|
||||
|
Reference in New Issue
Block a user