Skip to content
Snippets Groups Projects
Commit d889b9f2 authored by Eloi Bail's avatar Eloi Bail Committed by Guillaume Roguez
Browse files

daemon: define A/V bitrate and use it for encoding


Refs #68792

Change-Id: I42b94679fd3dc03926d5263b9e37dfd1d23d21f5
Signed-off-by: default avatarGuillaume Roguez <guillaume.roguez@savoirfairelinux.com>
parent 406a0b52
No related branches found
No related tags found
No related merge requests found
...@@ -116,10 +116,12 @@ SystemVideoCodecInfo::SystemVideoCodecInfo(unsigned m_avcodecId, ...@@ -116,10 +116,12 @@ SystemVideoCodecInfo::SystemVideoCodecInfo(unsigned m_avcodecId,
const std::string m_name, const std::string m_name,
std::string m_libName, std::string m_libName,
CodecType m_type, CodecType m_type,
unsigned m_bitrate,
unsigned m_payloadType, unsigned m_payloadType,
unsigned m_frameRate, unsigned m_frameRate,
unsigned m_profileId) 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) , frameRate(m_frameRate), profileId(m_profileId)
{} {}
......
...@@ -116,6 +116,7 @@ struct SystemVideoCodecInfo : SystemCodecInfo ...@@ -116,6 +116,7 @@ struct SystemVideoCodecInfo : SystemCodecInfo
{ {
SystemVideoCodecInfo(unsigned avcodecId, const std::string name, SystemVideoCodecInfo(unsigned avcodecId, const std::string name,
std::string libName, CodecType type = CODEC_NONE, std::string libName, CodecType type = CODEC_NONE,
unsigned bitrate = 0,
unsigned payloadType = 0, unsigned frameRate = 0, unsigned payloadType = 0, unsigned frameRate = 0,
unsigned profileId = 0); unsigned profileId = 0);
......
...@@ -81,7 +81,7 @@ void MediaEncoder::setDeviceOptions(const DeviceParams& args) ...@@ -81,7 +81,7 @@ void MediaEncoder::setDeviceOptions(const DeviceParams& args)
void MediaEncoder::setOptions(const MediaDescription& 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_, "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); auto accountAudioCodec = std::static_pointer_cast<AccountAudioCodecInfo>(args.codec);
if (accountAudioCodec->audioformat.sample_rate) if (accountAudioCodec->audioformat.sample_rate)
......
...@@ -40,6 +40,8 @@ namespace ring { ...@@ -40,6 +40,8 @@ namespace ring {
decltype(getGlobalInstance<SystemCodecContainer>)& getSystemCodecContainer = getGlobalInstance<SystemCodecContainer>; decltype(getGlobalInstance<SystemCodecContainer>)& getSystemCodecContainer = getGlobalInstance<SystemCodecContainer>;
constexpr static auto DEFAULT_VIDEO_BITRATE = 400;
SystemCodecContainer::SystemCodecContainer() SystemCodecContainer::SystemCodecContainer()
{ {
initCodecConfig(); initCodecConfig();
...@@ -58,19 +60,23 @@ SystemCodecContainer::initCodecConfig() ...@@ -58,19 +60,23 @@ SystemCodecContainer::initCodecConfig()
/* Define supported video codec*/ /* Define supported video codec*/
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H264, std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H264,
"H264", "libx264", "H264", "libx264",
CODEC_ENCODER_DECODER), CODEC_ENCODER_DECODER,
DEFAULT_VIDEO_BITRATE),
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H263, std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_H263,
"H263", "h263", "H263", "h263",
CODEC_ENCODER_DECODER), CODEC_ENCODER_DECODER,
DEFAULT_VIDEO_BITRATE),
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_VP8, std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_VP8,
"VP8", "libvpx", "VP8", "libvpx",
CODEC_ENCODER_DECODER), CODEC_ENCODER_DECODER,
DEFAULT_VIDEO_BITRATE),
std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_MPEG4, std::make_shared<SystemVideoCodecInfo>(AV_CODEC_ID_MPEG4,
"MP4V-ES", "mpeg4", "MP4V-ES", "mpeg4",
CODEC_ENCODER_DECODER), CODEC_ENCODER_DECODER,
DEFAULT_VIDEO_BITRATE),
#endif #endif
/* Define supported audio codec*/ /* Define supported audio codec*/
std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_PCM_ALAW, std::make_shared<SystemAudioCodecInfo>(AV_CODEC_ID_PCM_ALAW,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment