Commit cf457bdf authored by Éloi Bail's avatar Éloi Bail Committed by Éloi Bail

daemon: return codecs details if account not saved

During account creation, Dbus call "getCodecDetails"
must return default system codec details instead of empty list
as no account is created.

Refs #67589

Change-Id: Ic6432d25e1a4852a3fe4e21f57762d71dbf1e0b4
parent efff7016
......@@ -454,11 +454,29 @@ Account::mapStateNumberToString(RegistrationState state)
}
std::vector<unsigned>
Account::getDefaultCodecs()
Account::getDefaultCodecsId()
{
return getSystemCodecContainer()->getSystemCodecInfoIdList(MEDIA_ALL);
}
std::map<std::string, std::string>
Account::getDefaultCodecDetails(const unsigned& codecId)
{
auto codec = ring::getSystemCodecContainer()->searchCodecById(codecId, ring::MEDIA_ALL);
if (codec)
{
if (codec->mediaType & ring::MEDIA_AUDIO) {
auto audioCodec = std::static_pointer_cast<ring::SystemAudioCodecInfo>(codec);
return audioCodec->getCodecSpecifications();
}
if (codec->mediaType & ring::MEDIA_VIDEO) {
auto videoCodec = std::static_pointer_cast<ring::SystemVideoCodecInfo>(codec);
return videoCodec->getCodecSpecifications();
}
}
return {{}};
}
#define find_iter() \
const auto& iter = details.find(key); \
if (iter == details.end()) { \
......
......@@ -196,7 +196,8 @@ class Account : public Serializable, public std::enable_shared_from_this<Account
alias_ = alias;
}
static std::vector<unsigned> getDefaultCodecs();
static std::vector<unsigned> getDefaultCodecsId();
static std::map<std::string, std::string> getDefaultCodecDetails(const unsigned& codecId);
/* Accessor to data structures
* @return The list that reflects the user's choice
......
......@@ -256,14 +256,16 @@ getSupportedCiphers(const std::string& accountID)
return {};
}
std::map<std::string, std::string>
getCodecDetails(const std::string& accountID, const unsigned& codecId)
{
auto acc = ring::Manager::instance().getAccount(accountID);
if (!acc)
{
RING_ERR("Could not find account %s", accountID.c_str());
return {{}};
RING_ERR("Could not find account %s return default codec details"
, accountID.c_str());
return Account::getDefaultCodecDetails(codecId);
}
auto codec = acc->searchCodecById(codecId, ring::MEDIA_ALL);
......@@ -291,7 +293,7 @@ getActiveCodecList(const std::string& accountID)
if (auto acc = ring::Manager::instance().getAccount(accountID))
return acc->getActiveCodecs();
RING_ERR("Could not find account %s, returning default", accountID.c_str());
return Account::getDefaultCodecs();
return Account::getDefaultCodecsId();
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment