[ekiga] h323: set bandwidth according to network type
- From: Eugen Dedu <ededu src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga] h323: set bandwidth according to network type
- Date: Fri, 17 Aug 2012 08:45:06 +0000 (UTC)
commit 104e9bad4d31c6981f424acda600e8794d9d9a8c
Author: VÃctor Manuel JÃquez Leal <vjaquez igalia com>
Date: Thu Aug 16 23:21:34 2012 +0200
h323: set bandwidth according to network type
The bandwidth for the H323 endpoint was fixed to 40000 (4 Mbps) without any
apparent reason. Meanwhile, in Opal, the default is 100000 (10 Mbps).
It is clear then that the H323 bandwidth should be associated with the
configured network type and not a fixed value.
This patch assigns the bandwidth mapped from the configured network type:
PSTN & ISDN = 128 kbps
DSL = 4 Mbps
LAN & default = 10 Mbps
This mapping is also arbitrary, but it makes more sense than just a fixed
value.
lib/engine/components/opal/h323-endpoint.cpp | 29 ++++++++++++++++++++++++-
lib/engine/components/opal/h323-endpoint.h | 3 +-
lib/engine/components/opal/opal-main.cpp | 5 +++-
3 files changed, 33 insertions(+), 4 deletions(-)
---
diff --git a/lib/engine/components/opal/h323-endpoint.cpp b/lib/engine/components/opal/h323-endpoint.cpp
index 76619ba..3bb5e44 100644
--- a/lib/engine/components/opal/h323-endpoint.cpp
+++ b/lib/engine/components/opal/h323-endpoint.cpp
@@ -80,7 +80,7 @@ namespace Opal {
/* The class */
-Opal::H323::EndPoint::EndPoint (Opal::CallManager & _manager, Ekiga::ServiceCore & _core, unsigned _listen_port)
+Opal::H323::EndPoint::EndPoint (Opal::CallManager & _manager, Ekiga::ServiceCore & _core, unsigned _listen_port, unsigned _kind_of_net)
: H323EndPoint (_manager),
manager (_manager),
core (_core)
@@ -90,7 +90,7 @@ Opal::H323::EndPoint::EndPoint (Opal::CallManager & _manager, Ekiga::ServiceCore
listen_port = (_listen_port > 0 ? _listen_port : 1720);
/* Initial requested bandwidth */
- SetInitialBandwidth (40000);
+ set_initial_bandwidth (_kind_of_net);
/* Start listener */
set_listen_port (listen_port);
@@ -231,6 +231,31 @@ Opal::H323::EndPoint::set_listen_port (unsigned port)
return false;
}
+void
+Opal::H323::EndPoint::set_initial_bandwidth (unsigned kind_of_net)
+{
+ unsigned bandwidth = GetInitialBandwidth ();
+
+ switch (kind_of_net) {
+ case 0: // PSTN
+ case 1: // ISDN
+ bandwidth = 1280;
+ break;
+ case 2: // DSL128
+ case 3: // DSL512
+ bandwidth = 40000;
+ break;
+ case 4:
+ bandwidth = 100000;
+ break;
+ default:
+ break;
+ }
+
+ /* Initial requested bandwidth */
+ SetInitialBandwidth (bandwidth);
+}
+
const Ekiga::CallProtocolManager::Interface&
Opal::H323::EndPoint::get_listen_interface () const
diff --git a/lib/engine/components/opal/h323-endpoint.h b/lib/engine/components/opal/h323-endpoint.h
index ede8b6e..61ac314 100644
--- a/lib/engine/components/opal/h323-endpoint.h
+++ b/lib/engine/components/opal/h323-endpoint.h
@@ -65,7 +65,7 @@ namespace Opal {
PCLASSINFO(EndPoint, H323EndPoint);
public:
- EndPoint (CallManager &_manager, Ekiga::ServiceCore & core, unsigned listen_port);
+ EndPoint (CallManager &_manager, Ekiga::ServiceCore & core, unsigned listen_port, unsigned kind_of_net);
~EndPoint ();
@@ -101,6 +101,7 @@ namespace Opal {
bool set_listen_port (unsigned port);
const Ekiga::CallProtocolManager::Interface & get_listen_interface () const;
+ void set_initial_bandwidth (unsigned kind_of_net);
/* H.323 CallProtocolManager */
void set_forward_uri (const std::string & uri);
diff --git a/lib/engine/components/opal/opal-main.cpp b/lib/engine/components/opal/opal-main.cpp
index b997989..49a0349 100644
--- a/lib/engine/components/opal/opal-main.cpp
+++ b/lib/engine/components/opal/opal-main.cpp
@@ -56,6 +56,8 @@
#define H323_KEY "/apps/" PACKAGE_NAME "/protocols/h323/"
#endif
+#define GENERAL_KEY "/apps/" PACKAGE_NAME "/general/"
+
// opal manages its endpoints itself, so we must be wary
struct null_deleter
{
@@ -136,7 +138,8 @@ struct OPALSpark: public Ekiga::Spark
#ifdef HAVE_H323
unsigned h323_port = gm_conf_get_int (H323_KEY "listen_port");
- boost::shared_ptr<H323::EndPoint> h323_manager (new H323::EndPoint (*call_manager, core, h323_port), null_deleter ());
+ unsigned kind_of_net = gm_conf_get_int (GENERAL_KEY "kind_of_net");
+ boost::shared_ptr<H323::EndPoint> h323_manager (new H323::EndPoint (*call_manager, core, h323_port, kind_of_net), null_deleter ());
call_manager->add_protocol_manager (h323_manager);
contact_core->add_contact_decorator (h323_manager);
presence_core->add_presentity_decorator (h323_manager);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]