mirror of
https://git.jami.net/savoirfairelinux/jami-daemon.git
synced 2025-08-12 22:09:25 +08:00
* #13382: daemon: videoCodecs are now a list of hashtables
This commit is contained in:
@ -29,16 +29,23 @@
|
||||
* shall include the source code for the parts of OpenSSL used as well
|
||||
* as that of the covered work.
|
||||
*/
|
||||
|
||||
#ifdef HAVE_CONFIG_H
|
||||
#include "config.h"
|
||||
#endif
|
||||
#include "account.h"
|
||||
#include <algorithm>
|
||||
#ifdef SFL_VIDEO
|
||||
#include "video/libav_utils.h"
|
||||
#endif
|
||||
|
||||
#include "manager.h"
|
||||
#include "dbus/configurationmanager.h"
|
||||
#ifdef SFL_VIDEO
|
||||
#include "video/video_endpoint.h"
|
||||
#endif
|
||||
|
||||
const char * const Account::AUDIO_CODECS_KEY = "audioCodecs"; // 0/9/110/111/112/
|
||||
const char * const Account::VIDEO_CODECS_KEY = "videoCodecs";
|
||||
const char * const Account::VIDEO_CODEC_ENABLED = "enabled";
|
||||
const char * const Account::VIDEO_CODEC_NAME = "name";
|
||||
const char * const Account::VIDEO_CODEC_BITRATE = "bitrate";
|
||||
const char * const Account::RINGTONE_PATH_KEY = "ringtonePath";
|
||||
const char * const Account::RINGTONE_ENABLED_KEY = "ringtoneEnabled";
|
||||
const char * const Account::DISPLAY_NAME_KEY = "displayName";
|
||||
@ -52,7 +59,12 @@ const char * const Account::HOSTNAME_KEY = "hostname";
|
||||
const char * const Account::ACCOUNT_ENABLE_KEY = "enable";
|
||||
const char * const Account::MAILBOX_KEY = "mailbox";
|
||||
|
||||
Account::Account(const std::string &accountID, const std::string &type) :
|
||||
using std::map;
|
||||
using std::string;
|
||||
using std::vector;
|
||||
|
||||
|
||||
Account::Account(const string &accountID, const string &type) :
|
||||
accountID_(accountID)
|
||||
, username_()
|
||||
, hostname_()
|
||||
@ -63,7 +75,6 @@ Account::Account(const std::string &accountID, const std::string &type) :
|
||||
, audioCodecList_()
|
||||
, videoCodecList_()
|
||||
, audioCodecStr_()
|
||||
, videoCodecStr_()
|
||||
, ringtonePath_("/usr/share/sflphone/ringtones/konga.ul")
|
||||
, ringtoneEnabled_(true)
|
||||
, displayName_("")
|
||||
@ -94,7 +105,7 @@ void Account::loadDefaultCodecs()
|
||||
// CodecMap codecMap = Manager::instance ().getCodecDescriptorMap ().getCodecsMap();
|
||||
|
||||
// Initialize codec
|
||||
std::vector<std::string> result;
|
||||
vector<string> result;
|
||||
result.push_back("0");
|
||||
result.push_back("3");
|
||||
result.push_back("8");
|
||||
@ -105,31 +116,30 @@ void Account::loadDefaultCodecs()
|
||||
|
||||
setActiveAudioCodecs(result);
|
||||
#ifdef SFL_VIDEO
|
||||
setActiveVideoCodecs(sfl_video::getCodecList());
|
||||
setVideoCodecs(libav_utils::getDefaultCodecs());
|
||||
#endif
|
||||
}
|
||||
|
||||
void Account::setActiveVideoCodecs(const std::vector<std::string> &list)
|
||||
void Account::setVideoCodecs(const vector<map<string, string> > &list)
|
||||
{
|
||||
#ifdef SFL_VIDEO
|
||||
// first clear the previously stored codecs
|
||||
videoCodecList_.clear();
|
||||
videoCodecList_ = !list.empty() ? list : sfl_video::getCodecList();
|
||||
// update the codec string according to new codec selection
|
||||
videoCodecStr_ = ManagerImpl::join_string(list);
|
||||
// FIXME: do real validation here
|
||||
videoCodecList_ = list;
|
||||
#else
|
||||
(void) list;
|
||||
#endif
|
||||
}
|
||||
|
||||
void Account::setActiveAudioCodecs(const std::vector<std::string> &list)
|
||||
void Account::setActiveAudioCodecs(const vector<string> &list)
|
||||
{
|
||||
// first clear the previously stored codecs
|
||||
audioCodecList_.clear();
|
||||
|
||||
// list contains the ordered payload of active codecs picked by the user for this account
|
||||
// we used the CodecOrder vector to save the order.
|
||||
for (std::vector<std::string>::const_iterator iter = list.begin(); iter != list.end();
|
||||
for (vector<string>::const_iterator iter = list.begin(); iter != list.end();
|
||||
++iter) {
|
||||
int payload = std::atoi(iter->c_str());
|
||||
audioCodecList_.push_back(payload);
|
||||
@ -139,7 +149,7 @@ void Account::setActiveAudioCodecs(const std::vector<std::string> &list)
|
||||
audioCodecStr_ = ManagerImpl::join_string(list);
|
||||
}
|
||||
|
||||
std::string Account::mapStateNumberToString(RegistrationState state)
|
||||
string Account::mapStateNumberToString(RegistrationState state)
|
||||
{
|
||||
static const char * mapStateToChar[] = {
|
||||
"UNREGISTERED",
|
||||
@ -158,3 +168,26 @@ std::string Account::mapStateNumberToString(RegistrationState state)
|
||||
|
||||
return mapStateToChar[state];
|
||||
}
|
||||
|
||||
vector<map<string, string> >
|
||||
Account::getAllVideoCodecs() const
|
||||
{
|
||||
return videoCodecList_;
|
||||
}
|
||||
|
||||
namespace {
|
||||
bool is_inactive(const map<string, string> &codec)
|
||||
{
|
||||
map<string, string>::const_iterator iter = codec.find(Account::VIDEO_CODEC_ENABLED);
|
||||
return iter == codec.end() or iter->second != "true";
|
||||
}
|
||||
}
|
||||
|
||||
vector<map<string, string> >
|
||||
Account::getActiveVideoCodecs() const
|
||||
{
|
||||
// FIXME: validate video codec details first
|
||||
vector<map<string, string> > result(videoCodecList_);
|
||||
result.erase(std::remove_if(result.begin(), result.end(), is_inactive), result.end());
|
||||
return result;
|
||||
}
|
||||
|
@ -129,17 +129,16 @@ class Account : public Serializable {
|
||||
std::string getAlias() const {
|
||||
return alias_;
|
||||
}
|
||||
|
||||
void setAlias(const std::string &alias) {
|
||||
alias_ = alias;
|
||||
}
|
||||
|
||||
/**
|
||||
* Accessor to data structures
|
||||
* @return std::vector<std::string>& The list that reflects the user's choice
|
||||
*/
|
||||
std::vector<std::string> getActiveVideoCodecs() const {
|
||||
return videoCodecList_;
|
||||
}
|
||||
std::vector<std::map<std::string, std::string> >
|
||||
getAllVideoCodecs() const;
|
||||
|
||||
std::vector<std::map<std::string, std::string> >
|
||||
getActiveVideoCodecs() const;
|
||||
|
||||
/* Accessor to data structures
|
||||
* @return CodecOrder& The list that reflects the user's choice
|
||||
@ -153,7 +152,7 @@ class Account : public Serializable {
|
||||
* SDP offer and configuration respectively
|
||||
*/
|
||||
void setActiveAudioCodecs(const std::vector<std::string>& list);
|
||||
void setActiveVideoCodecs(const std::vector<std::string>& list);
|
||||
void setVideoCodecs(const std::vector<std::map<std::string, std::string> > &codecs);
|
||||
|
||||
std::string getRingtonePath() const {
|
||||
return ringtonePath_;
|
||||
@ -184,6 +183,7 @@ class Account : public Serializable {
|
||||
mailBox_ = mb;
|
||||
}
|
||||
|
||||
static const char * const VIDEO_CODEC_ENABLED;
|
||||
private:
|
||||
NON_COPYABLE(Account);
|
||||
|
||||
@ -197,6 +197,8 @@ class Account : public Serializable {
|
||||
// General configuration keys for accounts
|
||||
static const char * const AUDIO_CODECS_KEY;
|
||||
static const char * const VIDEO_CODECS_KEY;
|
||||
static const char * const VIDEO_CODEC_NAME;
|
||||
static const char * const VIDEO_CODEC_BITRATE;
|
||||
static const char * const RINGTONE_PATH_KEY;
|
||||
static const char * const RINGTONE_ENABLED_KEY;
|
||||
static const char * const DISPLAY_NAME_KEY;
|
||||
@ -257,9 +259,9 @@ class Account : public Serializable {
|
||||
std::vector<int> audioCodecList_;
|
||||
|
||||
/**
|
||||
* Vector containing the order of the video codecs
|
||||
* Vector containing the video codecs in order
|
||||
*/
|
||||
std::vector<std::string> videoCodecList_;
|
||||
std::vector<std::map<std::string, std::string> > videoCodecList_;
|
||||
|
||||
/**
|
||||
* List of audio codecs obtained when parsing configuration and used
|
||||
@ -267,12 +269,6 @@ class Account : public Serializable {
|
||||
*/
|
||||
std::string audioCodecStr_;
|
||||
|
||||
/**
|
||||
* List of video codecs obtained when parsing configuration and used
|
||||
* to generate codec order list
|
||||
*/
|
||||
std::string videoCodecStr_;
|
||||
|
||||
/**
|
||||
* Ringtone .au file used for this account
|
||||
*/
|
||||
|
@ -85,31 +85,18 @@
|
||||
|
||||
<!-- Video Codec related methods -->
|
||||
|
||||
<method name="getCodecList" tp:name-for-bindings="getCodecList">
|
||||
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/>
|
||||
<arg type="as" name="list" direction="out">
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="getCodecDetails" tp:name-for-bindings="getCodecDetails">
|
||||
<arg type="s" name="codec" direction="in">
|
||||
</arg>
|
||||
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapStringString"/>
|
||||
<arg type="a{ss}" name="details" direction="out" tp:type="String_String_Map">
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="getActiveCodecList" tp:name-for-bindings="getActiveCodecList">
|
||||
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/>
|
||||
<method name="getCodecs" tp:name-for-bindings="getCodecs">
|
||||
<tp:docstring>Gets the hashtable describing all the codecs and their parameters for a given account</tp:docstring>
|
||||
<arg type="s" name="accountID" direction="in">
|
||||
</arg>
|
||||
<arg type="as" name="list" direction="out">
|
||||
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorMapStringString"/>
|
||||
<arg type="aa{ss}" name="details" direction="out">
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="setActiveCodecList" tp:name-for-bindings="setActiveCodecList">
|
||||
<annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="VectorString"/>
|
||||
<arg type="as" name="list" direction="in">
|
||||
<method name="setCodecs" tp:name-for-bindings="setCodecs">
|
||||
<tp:docstring>Sets a vector of hashtables describing codecs and their parameters for a given account, one hashtable per codec</tp:docstring>
|
||||
<arg type="aa{ss}" name="details" direction="in">
|
||||
</arg>
|
||||
<arg type="s" name="accountID" direction="in">
|
||||
</arg>
|
||||
|
@ -32,7 +32,6 @@
|
||||
|
||||
#include "video_controls.h"
|
||||
#include "video/libav_utils.h"
|
||||
#include "video/video_endpoint.h"
|
||||
#include "video/video_preview.h"
|
||||
#include "account.h"
|
||||
#include "logger.h"
|
||||
@ -55,42 +54,23 @@ VideoControls::getVideoPreferences()
|
||||
return videoPreference_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Send the list of all codecs loaded to the client through DBus.
|
||||
* Can stay global, as only the active codecs will be set per accounts
|
||||
*/
|
||||
std::vector<std::string>
|
||||
VideoControls::getCodecList()
|
||||
std::vector<std::map<std::string, std::string> >
|
||||
VideoControls::getCodecs(const std::string &accountID)
|
||||
{
|
||||
return sfl_video::getCodecList();
|
||||
}
|
||||
|
||||
std::map<std::string, std::string>
|
||||
VideoControls::getCodecDetails(const std::string& name)
|
||||
{
|
||||
return sfl_video::getCodecSpecifications(name);
|
||||
}
|
||||
|
||||
std::vector<std::string>
|
||||
VideoControls::getActiveCodecList(const std::string& accountID)
|
||||
{
|
||||
std::vector<std::string> v;
|
||||
Account *acc = Manager::instance().getAccount(accountID);
|
||||
|
||||
if (acc != NULL)
|
||||
v = acc->getActiveVideoCodecs();
|
||||
|
||||
return v;
|
||||
|
||||
return acc->getAllVideoCodecs();
|
||||
else
|
||||
return std::vector<std::map<std::string, std::string> >();
|
||||
}
|
||||
|
||||
void
|
||||
VideoControls::setActiveCodecList(const std::vector<std::string>& list, const std::string& accountID)
|
||||
VideoControls::setCodecs(const std::vector<std::map<std::string, std::string> > &details, const std::string& accountID)
|
||||
{
|
||||
Account *acc = Manager::instance().getAccount(accountID);
|
||||
|
||||
if (acc != NULL) {
|
||||
acc->setActiveVideoCodecs(list);
|
||||
acc->setVideoCodecs(details);
|
||||
Manager::instance().saveConfig();
|
||||
}
|
||||
}
|
||||
|
@ -67,14 +67,12 @@ class VideoControls : public org::sflphone::SFLphone::VideoControls_adaptor,
|
||||
VideoControls(DBus::Connection& connection);
|
||||
VideoPreference &getVideoPreferences();
|
||||
|
||||
std::vector<std::string> getCodecList();
|
||||
std::map<std::string, std::string> getCodecDetails(const std::string& name);
|
||||
std::vector<std::map<std::string, std::string> >
|
||||
getCodecs(const std::string& accountID);
|
||||
|
||||
std::vector<std::string>
|
||||
getActiveCodecList(const std::string& accountID);
|
||||
|
||||
void setActiveCodecList(const std::vector<std::string> &list,
|
||||
const std::string& accountID);
|
||||
void
|
||||
setCodecs(const std::vector<std::map<std::string, std::string> > &details,
|
||||
const std::string& accountID);
|
||||
|
||||
std::vector<std::string>
|
||||
getDeviceList();
|
||||
@ -88,17 +86,35 @@ class VideoControls : public org::sflphone::SFLphone::VideoControls_adaptor,
|
||||
std::vector<std::string>
|
||||
getDeviceRateList(const std::string &dev, const std::string &channel, const std::string &size);
|
||||
|
||||
std::map<std::string, std::string> getSettings();
|
||||
std::map<std::string, std::string>
|
||||
getSettings();
|
||||
|
||||
void setActiveDevice(const std::string &dev);
|
||||
void setActiveDeviceChannel(const std::string &channel);
|
||||
void setActiveDeviceSize(const std::string &size);
|
||||
void setActiveDeviceRate(const std::string &rate);
|
||||
std::string getActiveDevice();
|
||||
std::string getActiveDeviceChannel();
|
||||
std::string getActiveDeviceSize();
|
||||
std::string getActiveDeviceRate();
|
||||
std::string getCurrentCodecName(const std::string &callID);
|
||||
void
|
||||
setActiveDevice(const std::string &dev);
|
||||
|
||||
void
|
||||
setActiveDeviceChannel(const std::string &channel);
|
||||
|
||||
void
|
||||
setActiveDeviceSize(const std::string &size);
|
||||
|
||||
void
|
||||
setActiveDeviceRate(const std::string &rate);
|
||||
|
||||
std::string
|
||||
getActiveDevice();
|
||||
|
||||
std::string
|
||||
getActiveDeviceChannel();
|
||||
|
||||
std::string
|
||||
getActiveDeviceSize();
|
||||
|
||||
std::string
|
||||
getActiveDeviceRate();
|
||||
|
||||
std::string
|
||||
getCurrentCodecName(const std::string &callID);
|
||||
|
||||
void startPreview();
|
||||
void stopPreview();
|
||||
|
@ -39,11 +39,9 @@
|
||||
#include "manager.h"
|
||||
|
||||
#include <algorithm>
|
||||
#ifdef SFL_VIDEO
|
||||
#include "video/video_endpoint.h"
|
||||
#endif
|
||||
|
||||
using std::string;
|
||||
using std::map;
|
||||
using std::vector;
|
||||
using std::stringstream;
|
||||
|
||||
@ -192,7 +190,8 @@ pjmedia_sdp_media *Sdp::setMediaDescriptorLine(bool audio)
|
||||
if (codec->getPayloadType () == 9)
|
||||
clock_rate = 8000;
|
||||
} else {
|
||||
enc_name = video_codec_list_[i];
|
||||
// FIXME: get this key from header
|
||||
enc_name = video_codec_list_[i]["name"];
|
||||
clock_rate = 90000;
|
||||
payload = dynamic_payload;
|
||||
}
|
||||
@ -253,21 +252,16 @@ void Sdp::setTelephoneEventRtpmap(pjmedia_sdp_media *med)
|
||||
med->attr[med->attr_count++] = attr_fmtp;
|
||||
}
|
||||
|
||||
void Sdp::setLocalMediaVideoCapabilities(const vector<string> &selectedCodecs)
|
||||
void Sdp::setLocalMediaVideoCapabilities(const vector<map<string, string> > &codecs)
|
||||
{
|
||||
video_codec_list_.clear();
|
||||
#ifdef SFL_VIDEO
|
||||
if (selectedCodecs.empty())
|
||||
throw SdpException("No selected video codec while building local SDP offer");
|
||||
|
||||
// video_codec_list will be the the intersection of selectedCodecs and
|
||||
// the codecs we have installed
|
||||
const vector<string> &codecs_list = sfl_video::getCodecList();
|
||||
for (vector<string>::const_iterator i = selectedCodecs.begin(); i != selectedCodecs.end(); ++i)
|
||||
if (std::find(codecs_list.begin(), codecs_list.end(), *i) != codecs_list.end())
|
||||
video_codec_list_.push_back(*i);
|
||||
if (codecs.empty())
|
||||
WARN("No selected video codec while building local SDP offer");
|
||||
else
|
||||
video_codec_list_ = codecs;
|
||||
#else
|
||||
(void) selectedCodecs;
|
||||
(void) codecs;
|
||||
#endif
|
||||
}
|
||||
|
||||
@ -297,7 +291,7 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
int Sdp::createLocalSession(const vector<int> &selectedAudioCodecs, const vector<string> &selectedVideoCodecs)
|
||||
int Sdp::createLocalSession(const vector<int> &selectedAudioCodecs, const vector<map<string, string> > &selectedVideoCodecs)
|
||||
{
|
||||
setLocalMediaAudioCapabilities(selectedAudioCodecs);
|
||||
setLocalMediaVideoCapabilities(selectedVideoCodecs);
|
||||
@ -344,7 +338,7 @@ int Sdp::createLocalSession(const vector<int> &selectedAudioCodecs, const vector
|
||||
return pjmedia_sdp_validate(localSession_);
|
||||
}
|
||||
|
||||
void Sdp::createOffer(const vector<int> &selectedCodecs, const vector<string> &videoCodecs)
|
||||
void Sdp::createOffer(const vector<int> &selectedCodecs, const vector<map<string, string> > &videoCodecs)
|
||||
{
|
||||
if (createLocalSession(selectedCodecs, videoCodecs) != PJ_SUCCESS)
|
||||
ERROR("Failed to create initial offer");
|
||||
@ -354,7 +348,7 @@ void Sdp::createOffer(const vector<int> &selectedCodecs, const vector<string> &v
|
||||
|
||||
void Sdp::receiveOffer(const pjmedia_sdp_session* remote,
|
||||
const vector<int> &selectedCodecs,
|
||||
const vector<string> &videoCodecs)
|
||||
const vector<map<string, string> > &videoCodecs)
|
||||
{
|
||||
if (!remote) {
|
||||
ERROR("Remote session is NULL");
|
||||
|
@ -121,7 +121,7 @@ class Sdp {
|
||||
* On building an invite outside a dialog, build the local offer and create the
|
||||
* SDP negotiator instance with it.
|
||||
*/
|
||||
void createOffer(const std::vector<int> &selectedCodecs, const std::vector<std::string> &videoCodecs);
|
||||
void createOffer(const std::vector<int> &selectedCodecs, const std::vector<std::map<std::string, std::string> > &videoCodecs);
|
||||
|
||||
/*
|
||||
* On receiving an invite outside a dialog, build the local offer and create the
|
||||
@ -131,7 +131,7 @@ class Sdp {
|
||||
*/
|
||||
void receiveOffer(const pjmedia_sdp_session* remote,
|
||||
const std::vector<int> &selectedCodecs,
|
||||
const std::vector<std::string> &videoCodecs);
|
||||
const std::vector<std::map<std::string, std::string> > &videoCodecs);
|
||||
|
||||
/**
|
||||
* Start the sdp negotiation.
|
||||
@ -285,7 +285,7 @@ class Sdp {
|
||||
* Codec Map used for offer
|
||||
*/
|
||||
std::vector<sfl::Codec *> audio_codec_list_;
|
||||
std::vector<std::string> video_codec_list_;
|
||||
std::vector<std::map<std::string, std::string> > video_codec_list_;
|
||||
|
||||
/**
|
||||
* The codecs that will be used by the session (after the SDP negotiation)
|
||||
@ -323,11 +323,12 @@ class Sdp {
|
||||
* @param List of codec in preference order
|
||||
*/
|
||||
void setLocalMediaAudioCapabilities(const std::vector<int> &selected);
|
||||
void setLocalMediaVideoCapabilities(const std::vector<std::string> &selected);
|
||||
void setLocalMediaVideoCapabilities(const std::vector<std::map<std::string, std::string> > &codecs);
|
||||
/*
|
||||
* Build the local SDP offer
|
||||
*/
|
||||
int createLocalSession(const std::vector<int> &selectedAudio, const std::vector<std::string> &selectedVideo);
|
||||
int createLocalSession(const std::vector<int> &selectedAudio,
|
||||
const std::vector<std::map<std::string, std::string> > &selectedVideo);
|
||||
/*
|
||||
* Adds a sdes attribute to the given media section.
|
||||
*
|
||||
|
@ -115,6 +115,7 @@ void SIPAccount::serialize(Conf::YamlEmitter &emitter)
|
||||
using namespace Conf;
|
||||
using std::vector;
|
||||
using std::string;
|
||||
using std::map;
|
||||
MappingNode accountmap(NULL);
|
||||
MappingNode srtpmap(NULL);
|
||||
MappingNode zrtpmap(NULL);
|
||||
@ -147,7 +148,16 @@ void SIPAccount::serialize(Conf::YamlEmitter &emitter)
|
||||
ScalarNode sameasLocal(publishedSameasLocal_);
|
||||
ScalarNode audioCodecs(audioCodecStr_);
|
||||
#ifdef SFL_VIDEO
|
||||
ScalarNode videoCodecs(videoCodecStr_);
|
||||
SequenceNode videoCodecs(NULL);
|
||||
accountmap.setKeyValue(VIDEO_CODECS_KEY, &videoCodecs);
|
||||
for (vector<map<string, string> >::iterator i = videoCodecList_.begin(); i != videoCodecList_.end(); ++i) {
|
||||
map<string, string> &codec = *i;
|
||||
MappingNode *mapNode = new MappingNode(NULL);
|
||||
mapNode->setKeyValue(VIDEO_CODEC_NAME, new ScalarNode(codec[VIDEO_CODEC_NAME]));
|
||||
mapNode->setKeyValue(VIDEO_CODEC_BITRATE, new ScalarNode(codec[VIDEO_CODEC_BITRATE]));
|
||||
mapNode->setKeyValue(VIDEO_CODEC_ENABLED, new ScalarNode(codec[VIDEO_CODEC_ENABLED]));
|
||||
videoCodecs.addNode(mapNode);
|
||||
}
|
||||
#endif
|
||||
|
||||
ScalarNode ringtonePath(ringtonePath_);
|
||||
@ -206,9 +216,6 @@ void SIPAccount::serialize(Conf::YamlEmitter &emitter)
|
||||
accountmap.setKeyValue(DTMF_TYPE_KEY, &dtmfType);
|
||||
accountmap.setKeyValue(DISPLAY_NAME_KEY, &displayName);
|
||||
accountmap.setKeyValue(AUDIO_CODECS_KEY, &audioCodecs);
|
||||
#ifdef SFL_VIDEO
|
||||
accountmap.setKeyValue(VIDEO_CODECS_KEY, &videoCodecs);
|
||||
#endif
|
||||
accountmap.setKeyValue(RINGTONE_PATH_KEY, &ringtonePath);
|
||||
accountmap.setKeyValue(RINGTONE_ENABLED_KEY, &ringtoneEnabled);
|
||||
accountmap.setKeyValue(KEEP_ALIVE_ENABLED, &keepAliveEnabled);
|
||||
@ -259,68 +266,96 @@ void SIPAccount::serialize(Conf::YamlEmitter &emitter)
|
||||
ERROR("%s", e.what());
|
||||
}
|
||||
|
||||
Sequence *seq = credentialseq.getSequence();
|
||||
Sequence::iterator seqit;
|
||||
|
||||
for (seqit = seq->begin(); seqit != seq->end(); ++seqit) {
|
||||
// Cleanup
|
||||
Sequence *credSeq = credentialseq.getSequence();
|
||||
for (Sequence::iterator seqit = credSeq->begin(); seqit != credSeq->end(); ++seqit) {
|
||||
MappingNode *node = static_cast<MappingNode*>(*seqit);
|
||||
delete node->getValue(CONFIG_ACCOUNT_USERNAME);
|
||||
delete node->getValue(CONFIG_ACCOUNT_PASSWORD);
|
||||
delete node->getValue(CONFIG_ACCOUNT_REALM);
|
||||
delete node;
|
||||
}
|
||||
|
||||
#ifdef SFL_VIDEO
|
||||
Sequence *videoCodecSeq = videoCodecs.getSequence();
|
||||
for (Sequence::iterator i = videoCodecSeq->begin(); i != videoCodecSeq->end(); ++i) {
|
||||
MappingNode *node = static_cast<MappingNode*>(*i);
|
||||
delete node->getValue(VIDEO_CODEC_NAME);
|
||||
delete node->getValue(VIDEO_CODEC_BITRATE);
|
||||
delete node->getValue(VIDEO_CODEC_ENABLED);
|
||||
delete node;
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SIPAccount::unserialize(const Conf::MappingNode &map)
|
||||
void SIPAccount::unserialize(const Conf::MappingNode &mapNode)
|
||||
{
|
||||
using namespace Conf;
|
||||
using std::vector;
|
||||
using std::map;
|
||||
using std::string;
|
||||
|
||||
map.getValue(ALIAS_KEY, &alias_);
|
||||
map.getValue(TYPE_KEY, &type_);
|
||||
map.getValue(USERNAME_KEY, &username_);
|
||||
if (not isIP2IP()) map.getValue(HOSTNAME_KEY, &hostname_);
|
||||
map.getValue(ACCOUNT_ENABLE_KEY, &enabled_);
|
||||
if (not isIP2IP()) map.getValue(MAILBOX_KEY, &mailBox_);
|
||||
map.getValue(AUDIO_CODECS_KEY, &audioCodecStr_);
|
||||
mapNode.getValue(ALIAS_KEY, &alias_);
|
||||
mapNode.getValue(TYPE_KEY, &type_);
|
||||
mapNode.getValue(USERNAME_KEY, &username_);
|
||||
if (not isIP2IP()) mapNode.getValue(HOSTNAME_KEY, &hostname_);
|
||||
mapNode.getValue(ACCOUNT_ENABLE_KEY, &enabled_);
|
||||
if (not isIP2IP()) mapNode.getValue(MAILBOX_KEY, &mailBox_);
|
||||
mapNode.getValue(AUDIO_CODECS_KEY, &audioCodecStr_);
|
||||
// Update codec list which one is used for SDP offer
|
||||
setActiveAudioCodecs(ManagerImpl::split_string(audioCodecStr_));
|
||||
#ifdef SFL_VIDEO
|
||||
map.getValue(VIDEO_CODECS_KEY, &videoCodecStr_);
|
||||
setActiveVideoCodecs(ManagerImpl::split_string(videoCodecStr_));
|
||||
vector<map<string, string> > videoCodecDetails;
|
||||
YamlNode *videoCodecsNode(mapNode.getValue(VIDEO_CODECS_KEY));
|
||||
|
||||
if (videoCodecsNode && videoCodecsNode->getType() == SEQUENCE) {
|
||||
SequenceNode *videoCodecs = static_cast<SequenceNode *>(videoCodecsNode);
|
||||
Sequence *seq = videoCodecs->getSequence();
|
||||
|
||||
for (Sequence::iterator it = seq->begin(); it != seq->end(); ++it) {
|
||||
MappingNode *codec = static_cast<MappingNode *>(*it);
|
||||
map<string, string> codecMap;
|
||||
codec->getValue(VIDEO_CODEC_NAME, &codecMap[VIDEO_CODEC_NAME]);
|
||||
codec->getValue(VIDEO_CODEC_BITRATE, &codecMap[VIDEO_CODEC_BITRATE]);
|
||||
codec->getValue(VIDEO_CODEC_ENABLED, &codecMap[VIDEO_CODEC_ENABLED]);
|
||||
videoCodecDetails.push_back(codecMap);
|
||||
}
|
||||
}
|
||||
setVideoCodecs(videoCodecDetails);
|
||||
#endif
|
||||
|
||||
map.getValue(RINGTONE_PATH_KEY, &ringtonePath_);
|
||||
map.getValue(RINGTONE_ENABLED_KEY, &ringtoneEnabled_);
|
||||
if (not isIP2IP()) map.getValue(Preferences::REGISTRATION_EXPIRE_KEY, ®istrationExpire_);
|
||||
map.getValue(INTERFACE_KEY, &interface_);
|
||||
mapNode.getValue(RINGTONE_PATH_KEY, &ringtonePath_);
|
||||
mapNode.getValue(RINGTONE_ENABLED_KEY, &ringtoneEnabled_);
|
||||
if (not isIP2IP()) mapNode.getValue(Preferences::REGISTRATION_EXPIRE_KEY, ®istrationExpire_);
|
||||
mapNode.getValue(INTERFACE_KEY, &interface_);
|
||||
int port = DEFAULT_SIP_PORT;
|
||||
map.getValue(PORT_KEY, &port);
|
||||
mapNode.getValue(PORT_KEY, &port);
|
||||
localPort_ = port;
|
||||
map.getValue(PUBLISH_ADDR_KEY, &publishedIpAddress_);
|
||||
map.getValue(PUBLISH_PORT_KEY, &port);
|
||||
mapNode.getValue(PUBLISH_ADDR_KEY, &publishedIpAddress_);
|
||||
mapNode.getValue(PUBLISH_PORT_KEY, &port);
|
||||
publishedPort_ = port;
|
||||
map.getValue(SAME_AS_LOCAL_KEY, &publishedSameasLocal_);
|
||||
if (not isIP2IP()) map.getValue(KEEP_ALIVE_ENABLED, &keepAliveEnabled_);
|
||||
mapNode.getValue(SAME_AS_LOCAL_KEY, &publishedSameasLocal_);
|
||||
if (not isIP2IP()) mapNode.getValue(KEEP_ALIVE_ENABLED, &keepAliveEnabled_);
|
||||
|
||||
std::string dtmfType;
|
||||
map.getValue(DTMF_TYPE_KEY, &dtmfType);
|
||||
mapNode.getValue(DTMF_TYPE_KEY, &dtmfType);
|
||||
dtmfType_ = dtmfType;
|
||||
|
||||
if (not isIP2IP()) map.getValue(SERVICE_ROUTE_KEY, &serviceRoute_);
|
||||
map.getValue(UPDATE_CONTACT_HEADER_KEY, &contactUpdateEnabled_);
|
||||
if (not isIP2IP()) mapNode.getValue(SERVICE_ROUTE_KEY, &serviceRoute_);
|
||||
mapNode.getValue(UPDATE_CONTACT_HEADER_KEY, &contactUpdateEnabled_);
|
||||
|
||||
// stun enabled
|
||||
if (not isIP2IP()) map.getValue(STUN_ENABLED_KEY, &stunEnabled_);
|
||||
if (not isIP2IP()) map.getValue(STUN_SERVER_KEY, &stunServer_);
|
||||
if (not isIP2IP()) mapNode.getValue(STUN_ENABLED_KEY, &stunEnabled_);
|
||||
if (not isIP2IP()) mapNode.getValue(STUN_SERVER_KEY, &stunServer_);
|
||||
|
||||
// Init stun server name with default server name
|
||||
stunServerName_ = pj_str((char*) stunServer_.data());
|
||||
|
||||
map.getValue(DISPLAY_NAME_KEY, &displayName_);
|
||||
mapNode.getValue(DISPLAY_NAME_KEY, &displayName_);
|
||||
|
||||
std::vector<std::map<std::string, std::string> > creds;
|
||||
|
||||
YamlNode *credNode = map.getValue(CRED_KEY);
|
||||
YamlNode *credNode = mapNode.getValue(CRED_KEY);
|
||||
|
||||
/* We check if the credential key is a sequence
|
||||
* because it was a mapping in a previous version of
|
||||
@ -351,7 +386,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map)
|
||||
// migration from old file format
|
||||
std::map<std::string, std::string> credmap;
|
||||
std::string password;
|
||||
if (not isIP2IP()) map.getValue(PASSWORD_KEY, &password);
|
||||
if (not isIP2IP()) mapNode.getValue(PASSWORD_KEY, &password);
|
||||
|
||||
credmap[CONFIG_ACCOUNT_USERNAME] = username_;
|
||||
credmap[CONFIG_ACCOUNT_PASSWORD] = password;
|
||||
@ -362,7 +397,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map)
|
||||
setCredentials(creds);
|
||||
|
||||
// get srtp submap
|
||||
MappingNode *srtpMap = static_cast<MappingNode *>(map.getValue(SRTP_KEY));
|
||||
MappingNode *srtpMap = static_cast<MappingNode *>(mapNode.getValue(SRTP_KEY));
|
||||
|
||||
if (srtpMap) {
|
||||
srtpMap->getValue(SRTP_ENABLE_KEY, &srtpEnabled_);
|
||||
@ -371,7 +406,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map)
|
||||
}
|
||||
|
||||
// get zrtp submap
|
||||
MappingNode *zrtpMap = static_cast<MappingNode *>(map.getValue(ZRTP_KEY));
|
||||
MappingNode *zrtpMap = static_cast<MappingNode *>(mapNode.getValue(ZRTP_KEY));
|
||||
|
||||
if (zrtpMap) {
|
||||
zrtpMap->getValue(DISPLAY_SAS_KEY, &zrtpDisplaySas_);
|
||||
@ -381,7 +416,7 @@ void SIPAccount::unserialize(const Conf::MappingNode &map)
|
||||
}
|
||||
|
||||
// get tls submap
|
||||
MappingNode *tlsMap = static_cast<MappingNode *>(map.getValue(TLS_KEY));
|
||||
MappingNode *tlsMap = static_cast<MappingNode *>(mapNode.getValue(TLS_KEY));
|
||||
|
||||
if (tlsMap) {
|
||||
tlsMap->getValue(TLS_ENABLE_KEY, &tlsEnable_);
|
||||
|
@ -1608,6 +1608,8 @@ void handle_media_control(pjsip_inv_session * inv, pjsip_transaction *tsx, pjsip
|
||||
200, NULL, &tdata);
|
||||
if (status == PJ_SUCCESS)
|
||||
status = pjsip_tsx_send_msg(tsx, tdata);
|
||||
#else
|
||||
(void) inv;
|
||||
#endif
|
||||
} else {
|
||||
status = pjsip_endpt_create_response(tsx->endpt, rdata,
|
||||
|
@ -3,14 +3,14 @@ include $(top_srcdir)/globals.mak
|
||||
SUBDIRS=test
|
||||
|
||||
noinst_LTLIBRARIES = libvideo.la
|
||||
libvideo_la_SOURCES = video_endpoint.cpp video_endpoint.h libav_utils.cpp \
|
||||
libav_utils.h video_rtp_session.cpp video_rtp_session.h \
|
||||
video_send_thread.h video_send_thread.cpp \
|
||||
video_receive_thread.h video_receive_thread.cpp \
|
||||
video_preview.h video_preview.cpp video_v4l2.cpp \
|
||||
video_v4l2_list.cpp video_v4l2.h video_v4l2_list.h \
|
||||
video_preferences.h video_preferences.cpp \
|
||||
packet_handle.h packet_handle.cpp check.h shm_header.h shm_sink.cpp shm_sink.h
|
||||
libvideo_la_SOURCES = libav_utils.cpp libav_utils.h video_rtp_session.cpp \
|
||||
video_rtp_session.h video_send_thread.h video_send_thread.cpp \
|
||||
video_receive_thread.h video_receive_thread.cpp \
|
||||
video_preview.h video_preview.cpp video_v4l2.cpp \
|
||||
video_v4l2_list.cpp video_v4l2.h video_v4l2_list.h \
|
||||
video_preferences.h video_preferences.cpp \
|
||||
packet_handle.h packet_handle.cpp check.h shm_header.h \
|
||||
shm_sink.cpp shm_sink.h
|
||||
|
||||
libvideo_la_LIBADD = @LIBAVCODEC_LIBS@ @LIBAVFORMAT_LIBS@ @LIBAVDEVICE_LIBS@ @LIBSWSCALE_LIBS@ @LIBAVUTIL_LIBS@ @CCRTP_LIBS@ @UDEV_LIBS@
|
||||
|
||||
|
@ -141,4 +141,22 @@ void sfl_avcodec_init()
|
||||
findInstalledVideoCodecs();
|
||||
}
|
||||
|
||||
std::vector<std::map<std::string, std::string> >
|
||||
getDefaultCodecs()
|
||||
{
|
||||
const char * const DEFAULT_BITRATE = "400";
|
||||
sfl_avcodec_init();
|
||||
std::vector<std::map<std::string, std::string> > result;
|
||||
for (std::vector<std::string>::const_iterator iter = installed_video_codecs_.begin();
|
||||
iter != installed_video_codecs_.end(); ++iter) {
|
||||
std::map<std::string, std::string> codec;
|
||||
// FIXME: get these keys from proper place
|
||||
codec["name"] = *iter;
|
||||
codec["bitrate"] = DEFAULT_BITRATE;
|
||||
codec["enabled"] = "true";
|
||||
result.push_back(codec);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
} // end namespace libav_utils
|
||||
|
@ -36,9 +36,17 @@
|
||||
#include <string>
|
||||
|
||||
namespace libav_utils {
|
||||
void sfl_avcodec_init();
|
||||
std::map<std::string, std::string> encodersMap();
|
||||
std::vector<std::string> getVideoCodecList();
|
||||
void
|
||||
sfl_avcodec_init();
|
||||
|
||||
std::map<std::string, std::string>
|
||||
encodersMap();
|
||||
|
||||
std::vector<std::string>
|
||||
getVideoCodecList();
|
||||
|
||||
std::vector<std::map<std::string, std::string> >
|
||||
getDefaultCodecs();
|
||||
}
|
||||
|
||||
#endif // __LIBAV_UTILS_H__
|
||||
|
@ -33,17 +33,16 @@
|
||||
#include <memory>
|
||||
#include <iostream>
|
||||
#include <cassert>
|
||||
#include "video_endpoint.h"
|
||||
#include "libav_utils.h"
|
||||
|
||||
void VideoEndpointTest::testListInstalledCodecs()
|
||||
{
|
||||
/* This would list codecs */
|
||||
std::cout << "Installed codecs:" << std::endl;
|
||||
std::vector<std::string> codecs = sfl_video::getCodecList();
|
||||
std::cout << "Installed codecs:" << std::endl;
|
||||
std::vector<std::string> codecs(libav_utils::getVideoCodecList());
|
||||
std::vector<std::string>::iterator it;
|
||||
for (it = codecs.begin(); it != codecs.end(); ++it)
|
||||
std::cout << '\t' << *it << std::endl;
|
||||
for (it = codecs.begin(); it != codecs.end(); ++it)
|
||||
std::cout << '\t' << *it << std::endl;
|
||||
}
|
||||
|
||||
int main ()
|
||||
|
@ -1,72 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
|
||||
* Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. *
|
||||
* Additional permission under GNU GPL version 3 section 7:
|
||||
*
|
||||
* If you modify this program, or any covered work, by linking or
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a
|
||||
* modified version of that library), containing parts covered by the
|
||||
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
|
||||
* grants you additional permission to convey the resulting work.
|
||||
* Corresponding Source for a non-source form of such a combination
|
||||
* shall include the source code for the parts of OpenSSL used as well
|
||||
* as that of the covered work.
|
||||
*/
|
||||
|
||||
#include "video_endpoint.h"
|
||||
|
||||
#include <sstream>
|
||||
#include <vector>
|
||||
#include "libav_utils.h"
|
||||
|
||||
namespace sfl_video {
|
||||
|
||||
/* anonymous namespace */
|
||||
namespace {
|
||||
int FAKE_BITRATE()
|
||||
{
|
||||
return 1000;
|
||||
}
|
||||
|
||||
/* FIXME: use real bitrates */
|
||||
int getBitRate(const std::string & /*codec*/)
|
||||
{
|
||||
return FAKE_BITRATE();
|
||||
}
|
||||
} // end anonymous namespace
|
||||
|
||||
std::vector<std::string> getCodecList()
|
||||
{
|
||||
return libav_utils::getVideoCodecList();
|
||||
}
|
||||
|
||||
std::map<std::string, std::string> getCodecSpecifications(const std::string &codec)
|
||||
{
|
||||
std::map<std::string, std::string> specs;
|
||||
const char * const NAME_KEY = "name";
|
||||
const char * const BITRATE_KEY = "bitrate";
|
||||
|
||||
// Add the bit rate
|
||||
specs[NAME_KEY] = codec;
|
||||
std::stringstream ss;
|
||||
ss << getBitRate(codec);
|
||||
specs[BITRATE_KEY] = ss.str();
|
||||
|
||||
return specs;
|
||||
}
|
||||
|
||||
} // end namespace sfl_video
|
@ -1,46 +0,0 @@
|
||||
/*
|
||||
* Copyright (C) 2004, 2005, 2006, 2009, 2008, 2009, 2010, 2011 Savoir-Faire Linux Inc.
|
||||
* Author: Tristan Matthews <tristan.matthews@savoirfairelinux.com>
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 3 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
||||
*
|
||||
* Additional permission under GNU GPL version 3 section 7:
|
||||
*
|
||||
* If you modify this program, or any covered work, by linking or
|
||||
* combining it with the OpenSSL project's OpenSSL library (or a
|
||||
* modified version of that library), containing parts covered by the
|
||||
* terms of the OpenSSL or SSLeay licenses, Savoir-Faire Linux Inc.
|
||||
* grants you additional permission to convey the resulting work.
|
||||
* Corresponding Source for a non-source form of such a combination
|
||||
* shall include the source code for the parts of OpenSSL used as well
|
||||
* as that of the covered work.
|
||||
*/
|
||||
|
||||
#ifndef VIDEO_ENDPOINT_H__
|
||||
#define VIDEO_ENDPOINT_H__
|
||||
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
namespace sfl_video {
|
||||
/**
|
||||
* Returns the list of codecs installed at runtime and that we support
|
||||
*/
|
||||
std::vector<std::string> getCodecList();
|
||||
std::map<std::string, std::string> getCodecSpecifications(const std::string &codec);
|
||||
}
|
||||
|
||||
#endif // VIDEO_ENDPOINT_H__
|
@ -53,8 +53,15 @@ namespace {
|
||||
}
|
||||
}
|
||||
|
||||
void cleanup()
|
||||
{
|
||||
std::cerr << "Killing all sipp processes" << std::endl;
|
||||
system("killall sipp");
|
||||
}
|
||||
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
atexit(cleanup);
|
||||
printf("\nSFLphone Daemon Test Suite, by Savoir-Faire Linux 2004-2010\n\n");
|
||||
Logger::setConsoleLog(true);
|
||||
Logger::setDebugMode(true);
|
||||
|
@ -121,6 +121,22 @@ void SDPTest::receiveAnswerAfterInitialOffer(const pjmedia_sdp_session* remote)
|
||||
CPPUNIT_ASSERT(pjmedia_sdp_neg_get_state(session_->negotiator_) == PJMEDIA_SDP_NEG_STATE_WAIT_NEGO);
|
||||
}
|
||||
|
||||
namespace {
|
||||
std::vector<std::map<std::string, std::string> >
|
||||
createVideoCodecs() {
|
||||
std::vector<std::map<std::string, std::string> > videoCodecs;
|
||||
#ifdef SFL_VIDEO
|
||||
std::map<std::string, std::string> codec;
|
||||
codec["name"] = "H264";
|
||||
codec["enabled"] = "true";
|
||||
videoCodecs.push_back(codec);
|
||||
codec["name"] = "H263";
|
||||
videoCodecs.push_back(codec);
|
||||
#endif
|
||||
return videoCodecs;
|
||||
}
|
||||
}
|
||||
|
||||
void SDPTest::testInitialOfferFirstCodec()
|
||||
{
|
||||
std::cout << "------------ SDPTest::testInitialOfferFirstCodec --------------" << std::endl;
|
||||
@ -134,11 +150,7 @@ void SDPTest::testInitialOfferFirstCodec()
|
||||
codecSelection.push_back(PAYLOAD_CODEC_ALAW);
|
||||
codecSelection.push_back(PAYLOAD_CODEC_G722);
|
||||
|
||||
std::vector<std::string> videoCodecs;
|
||||
#ifdef SFL_VIDEO
|
||||
videoCodecs.push_back("H264");
|
||||
videoCodecs.push_back("H263");
|
||||
#endif
|
||||
std::vector<std::map<std::string, std::string> > videoCodecs(createVideoCodecs());
|
||||
|
||||
session_->setLocalIP(LOCALHOST);
|
||||
session_->setLocalPublishedAudioPort(49567);
|
||||
@ -171,18 +183,12 @@ void SDPTest::testInitialAnswerFirstCodec()
|
||||
codecSelection.push_back(PAYLOAD_CODEC_ALAW);
|
||||
codecSelection.push_back(PAYLOAD_CODEC_G722);
|
||||
|
||||
std::vector<std::string> videoCodecs;
|
||||
#ifdef SFL_VIDEO
|
||||
videoCodecs.push_back("H264");
|
||||
videoCodecs.push_back("H263");
|
||||
#endif
|
||||
|
||||
pjmedia_sdp_parse(testPool_, (char*) sdp_offer1, strlen(sdp_offer1), &remoteOffer);
|
||||
|
||||
session_->setLocalIP(LOCALHOST);
|
||||
session_->setLocalPublishedAudioPort(49567);
|
||||
|
||||
session_->receiveOffer(remoteOffer, codecSelection, videoCodecs);
|
||||
session_->receiveOffer(remoteOffer, codecSelection, createVideoCodecs());
|
||||
|
||||
session_->startNegotiation();
|
||||
|
||||
@ -205,16 +211,10 @@ void SDPTest::testInitialOfferLastCodec()
|
||||
codecSelection.push_back(PAYLOAD_CODEC_ALAW);
|
||||
codecSelection.push_back(PAYLOAD_CODEC_G722);
|
||||
|
||||
std::vector<std::string> videoCodecs;
|
||||
#ifdef SFL_VIDEO
|
||||
videoCodecs.push_back("H264");
|
||||
videoCodecs.push_back("H263");
|
||||
#endif
|
||||
|
||||
session_->setLocalIP(LOCALHOST);
|
||||
session_->setLocalPublishedAudioPort(49567);
|
||||
|
||||
session_->createOffer(codecSelection, videoCodecs);
|
||||
session_->createOffer(codecSelection, createVideoCodecs());
|
||||
|
||||
pjmedia_sdp_session *remoteAnswer;
|
||||
pjmedia_sdp_parse(testPool_, (char*) sdp_answer2, strlen(sdp_answer2), &remoteAnswer);
|
||||
@ -242,18 +242,12 @@ void SDPTest::testInitialAnswerLastCodec()
|
||||
codecSelection.push_back(PAYLOAD_CODEC_ALAW);
|
||||
codecSelection.push_back(PAYLOAD_CODEC_G722);
|
||||
|
||||
std::vector<std::string> videoCodecs;
|
||||
#ifdef SFL_VIDEO
|
||||
videoCodecs.push_back("H264");
|
||||
videoCodecs.push_back("H263");
|
||||
#endif
|
||||
|
||||
pjmedia_sdp_parse(testPool_, (char*)sdp_offer2, strlen(sdp_offer2), &remoteOffer);
|
||||
|
||||
session_->setLocalIP(LOCALHOST);
|
||||
session_->setLocalPublishedAudioPort(49567);
|
||||
|
||||
session_->receiveOffer(remoteOffer, codecSelection, videoCodecs);
|
||||
session_->receiveOffer(remoteOffer, codecSelection, createVideoCodecs());
|
||||
|
||||
session_->startNegotiation();
|
||||
|
||||
@ -276,15 +270,10 @@ void SDPTest::testReinvite()
|
||||
codecSelection.push_back(PAYLOAD_CODEC_ALAW);
|
||||
codecSelection.push_back(PAYLOAD_CODEC_G722);
|
||||
|
||||
std::vector<std::string> videoCodecs;
|
||||
#ifdef SFL_VIDEO
|
||||
videoCodecs.push_back("H264");
|
||||
videoCodecs.push_back("H263");
|
||||
#endif
|
||||
|
||||
session_->setLocalIP(LOCALHOST);
|
||||
session_->setLocalPublishedAudioPort(49567);
|
||||
|
||||
std::vector<std::map<std::string, std::string> > videoCodecs(createVideoCodecs());
|
||||
session_->createOffer(codecSelection, videoCodecs);
|
||||
|
||||
pjmedia_sdp_session *remoteAnswer;
|
||||
|
@ -93,6 +93,13 @@ accounts:
|
||||
type: SIP
|
||||
updateContact: false
|
||||
username:
|
||||
videoCodecs:
|
||||
- bitrate: 400
|
||||
enabled: true
|
||||
name: H263-2000
|
||||
- bitrate: 400
|
||||
enabled: true
|
||||
name: H264
|
||||
zrtp:
|
||||
displaySas: true
|
||||
displaySasOnce: false
|
||||
|
@ -85,31 +85,18 @@
|
||||
|
||||
<!-- Video Codec related methods -->
|
||||
|
||||
<method name="getCodecList" tp:name-for-bindings="getCodecList">
|
||||
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/>
|
||||
<arg type="as" name="list" direction="out">
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="getCodecDetails" tp:name-for-bindings="getCodecDetails">
|
||||
<arg type="s" name="codec" direction="in">
|
||||
</arg>
|
||||
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="MapStringString"/>
|
||||
<arg type="a{ss}" name="details" direction="out" tp:type="String_String_Map">
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="getActiveCodecList" tp:name-for-bindings="getActiveCodecList">
|
||||
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorString"/>
|
||||
<method name="getCodecs" tp:name-for-bindings="getCodecs">
|
||||
<tp:docstring>Gets the hashtable describing all the codecs and their parameters for a given account</tp:docstring>
|
||||
<arg type="s" name="accountID" direction="in">
|
||||
</arg>
|
||||
<arg type="as" name="list" direction="out">
|
||||
<annotation name="com.trolltech.QtDBus.QtTypeName.Out0" value="VectorMapStringString"/>
|
||||
<arg type="aa{ss}" name="details" direction="out">
|
||||
</arg>
|
||||
</method>
|
||||
|
||||
<method name="setActiveCodecList" tp:name-for-bindings="setActiveCodecList">
|
||||
<annotation name="com.trolltech.QtDBus.QtTypeName.In0" value="VectorString"/>
|
||||
<arg type="as" name="list" direction="in">
|
||||
<method name="setCodecs" tp:name-for-bindings="setCodecs">
|
||||
<tp:docstring>Sets a vector of hashtables describing codecs and their parameters for a given account, one hashtable per codec</tp:docstring>
|
||||
<arg type="aa{ss}" name="details" direction="in">
|
||||
</arg>
|
||||
<arg type="s" name="accountID" direction="in">
|
||||
</arg>
|
||||
|
Reference in New Issue
Block a user