diff --git a/src/dring/account_const.h b/src/dring/account_const.h index cce6bc96795cc9a54ec11642a66386fcbbbbd23f..6c03dcebf88c5e24e274ad12ed6b1d2ceeb633b6 100644 --- a/src/dring/account_const.h +++ b/src/dring/account_const.h @@ -227,6 +227,7 @@ constexpr static const char QUALITY [] = "CodecInfo.quality"; constexpr static const char MIN_QUALITY [] = "CodecInfo.min_quality"; constexpr static const char MAX_QUALITY [] = "CodecInfo.max_quality"; constexpr static const char CHANNEL_NUMBER [] = "CodecInfo.channelNumber"; +constexpr static const char AUTO_QUALITY_ENABLED [] = "CodecInfo.autoQualityEnabled"; } //namespace DRing::Account::ConfProperties::CodecInfo diff --git a/src/media/media_codec.cpp b/src/media/media_codec.cpp index 5e98b1c997d34ad388c4ed82ce442781c0e57c5f..6af478e776b9c9624333cf7ec2a525cba8477446 100644 --- a/src/media/media_codec.cpp +++ b/src/media/media_codec.cpp @@ -23,6 +23,7 @@ #include "account_const.h" #include "string_utils.h" +#include "logger.h" #include <string> #include <sstream> @@ -202,7 +203,8 @@ AccountVideoCodecInfo::getCodecSpecifications() {DRing::Account::ConfProperties::CodecInfo::QUALITY, to_string(quality)}, {DRing::Account::ConfProperties::CodecInfo::MAX_QUALITY, to_string(systemCodecInfo.maxQuality)}, {DRing::Account::ConfProperties::CodecInfo::MIN_QUALITY, to_string(systemCodecInfo.minQuality)}, - {DRing::Account::ConfProperties::CodecInfo::FRAME_RATE, to_string(frameRate)} + {DRing::Account::ConfProperties::CodecInfo::FRAME_RATE, to_string(frameRate)}, + {DRing::Account::ConfProperties::CodecInfo::AUTO_QUALITY_ENABLED, bool_to_str(isAutoQualityEnabled)} }; } @@ -220,6 +222,10 @@ AccountVideoCodecInfo::setCodecSpecifications(const std::map<std::string, std::s it = details.find(DRing::Account::ConfProperties::CodecInfo::QUALITY); if (it != details.end()) quality = ring::stoi(it->second); + + it = details.find(DRing::Account::ConfProperties::CodecInfo::AUTO_QUALITY_ENABLED); + if (it != details.end()) + isAutoQualityEnabled = (it->second == TRUE_STR) ? true : false; } AccountVideoCodecInfo::~AccountVideoCodecInfo() diff --git a/src/media/media_codec.h b/src/media/media_codec.h index aa5e339d12e8c788b9639df53c6f3ca61cacffdc..8b7aeae09940d2498e9e173035569c8458c5214f 100644 --- a/src/media/media_codec.h +++ b/src/media/media_codec.h @@ -191,6 +191,7 @@ struct AccountVideoCodecInfo : AccountCodecInfo unsigned frameRate; unsigned profileId; std::string parameters; + bool isAutoQualityEnabled{true}; }; bool operator== (SystemCodecInfo codec1, SystemCodecInfo codec2); diff --git a/src/media/video/video_rtp_session.cpp b/src/media/video/video_rtp_session.cpp index 02abf7bf1f33737e345804dcb6a45278a93db32f..c09b5f355163311088ba50e985958cf297cb14fb 100644 --- a/src/media/video/video_rtp_session.cpp +++ b/src/media/video/video_rtp_session.cpp @@ -104,8 +104,12 @@ void VideoRtpSession::startSender() RING_ERR("%s", e.what()); send_.enabled = false; } - if (not rtcpCheckerThread_.isRunning()) + auto codecVideo = std::static_pointer_cast<ring::AccountVideoCodecInfo>(send_.codec); + auto isAutoQualityEnabledStr = codecVideo->getCodecSpecifications()[DRing::Account::ConfProperties::CodecInfo::AUTO_QUALITY_ENABLED]; + if ((not rtcpCheckerThread_.isRunning()) && (isAutoQualityEnabledStr.compare(TRUE_STR) == 0)) rtcpCheckerThread_.start(); + else if ((rtcpCheckerThread_.isRunning()) && (isAutoQualityEnabledStr.compare(FALSE_STR) == 0)) + rtcpCheckerThread_.join(); } }