From b39dd34ef87dfc2ad9ccca282d228683e343f1f4 Mon Sep 17 00:00:00 2001
From: Alexandre Savard <alexandre.savard@savoirfairelinux.com>
Date: Thu, 16 Aug 2012 18:00:37 -0400
Subject: [PATCH] #14615: Fix default audio codec when creating new account

---
 daemon/src/account.cpp                   | 15 +++++++++++++++
 daemon/src/account.h                     |  2 ++
 daemon/src/dbus/configurationmanager.cpp |  4 ++--
 3 files changed, 19 insertions(+), 2 deletions(-)

diff --git a/daemon/src/account.cpp b/daemon/src/account.cpp
index 7a99629cd4..f5d75e273f 100644
--- a/daemon/src/account.cpp
+++ b/daemon/src/account.cpp
@@ -247,6 +247,21 @@ namespace {
     }
 }
 
+vector<int>
+Account::getDefaultAudioCodecs()
+{
+    vector<int> result;
+    result.push_back(0);
+    result.push_back(3);
+    result.push_back(8);
+    result.push_back(9);
+    result.push_back(110);
+    result.push_back(111);
+    result.push_back(112);
+
+    return result;
+}
+
 vector<map<string, string> >
 Account::getActiveVideoCodecs() const
 {
diff --git a/daemon/src/account.h b/daemon/src/account.h
index 0d67a797f3..fba2bbf54f 100644
--- a/daemon/src/account.h
+++ b/daemon/src/account.h
@@ -144,6 +144,8 @@ class Account : public Serializable {
         std::vector<std::map<std::string, std::string> >
         getActiveVideoCodecs() const;
 
+        static std::vector<int> getDefaultAudioCodecs();
+
          /* Accessor to data structures
          * @return The list that reflects the user's choice
          */
diff --git a/daemon/src/dbus/configurationmanager.cpp b/daemon/src/dbus/configurationmanager.cpp
index 62deef0b26..96da9af473 100644
--- a/daemon/src/dbus/configurationmanager.cpp
+++ b/daemon/src/dbus/configurationmanager.cpp
@@ -218,8 +218,8 @@ std::vector<int32_t> ConfigurationManager::getActiveAudioCodecList(const std::st
     if (acc)
         return acc->getActiveAudioCodecs();
     else {
-        ERROR("Could not find account %s", accountID.c_str());
-        return std::vector<int32_t>();
+        ERROR("Could not find account %s, returning default", accountID.c_str());
+        return Account::getDefaultAudioCodecs();
     }
 }
 
-- 
GitLab