diff --git a/include/ice_options.h b/include/ice_options.h index 33ac76efcc4a466a8f9644defaf8dc089e1eb9a5..f117495b653d42b7c817a10d560852acbfde20db 100644 --- a/include/ice_options.h +++ b/include/ice_options.h @@ -67,6 +67,19 @@ struct TurnServerInfo std::string realm; // credentials realm (optional, empty if not used) }; +/** Maps PJSIP QOS types */ +enum class QosType +{ + BEST_EFFORT, /**< Best effort traffic (default value). + Any QoS function calls with specifying + this value are effectively no-op */ + BACKGROUND, /**< Background traffic. */ + VIDEO, /**< Video traffic. */ + VOICE, /**< Voice traffic. */ + CONTROL, /**< Control traffic. */ + SIGNALLING /**< Signalling traffic. */ +}; + struct IceTransportOptions { std::shared_ptr<IceTransportFactory> factory {}; @@ -83,6 +96,8 @@ struct IceTransportOptions IpAddr accountLocalAddr {}; IpAddr accountPublicAddr {}; std::shared_ptr<upnp::UPnPContext> upnpContext {}; + /** Per component QoS Type. */ + std::vector<QosType> qosType {}; }; } diff --git a/src/ice_transport.cpp b/src/ice_transport.cpp index 2817195f3b92930418c742848de7c8d5ba2407ee..52a6383ee023862b97de280849ade61487e21027 100644 --- a/src/ice_transport.cpp +++ b/src/ice_transport.cpp @@ -423,6 +423,15 @@ IceTransport::Impl::initIceInstance(const IceTransportOptions& options) config_.stun.conn_type = PJ_STUN_TP_UDP; config_.turn.conn_type = PJ_TURN_TP_UDP; } + if (options.qosType.size() == 1) { + config_.stun.cfg.qos_type = (pj_qos_type)options.qosType[0]; + config_.turn.cfg.qos_type = (pj_qos_type)options.qosType[0]; + } + if (options.qosType.size() == compCount_) { + for (unsigned i = 0; i < compCount_; ++i) { + config_.comp[i].qos_type = (pj_qos_type)(options.qosType[i]); + } + } pool_.reset( pj_pool_create(factory->getPoolFactory(), "IceTransport.pool", 512, 512, NULL));