diff options
Diffstat (limited to 'Swiften/ScreenSharing/RTPSessionImpl.cpp')
-rw-r--r-- | Swiften/ScreenSharing/RTPSessionImpl.cpp | 35 |
1 files changed, 25 insertions, 10 deletions
diff --git a/Swiften/ScreenSharing/RTPSessionImpl.cpp b/Swiften/ScreenSharing/RTPSessionImpl.cpp index b8c443e..eb67d4e 100644 --- a/Swiften/ScreenSharing/RTPSessionImpl.cpp +++ b/Swiften/ScreenSharing/RTPSessionImpl.cpp @@ -7,11 +7,14 @@ #include <Swiften/ScreenSharing/RTPSessionImpl.h> #include <Swiften/ScreenSharing/RTPException.h> +#include <Swiften/Network/BoostUDPSocket.h> +#include <Swiften/Base/boost_bsignals.h> #include <boost/algorithm/string/split.hpp> #include <boost/algorithm/string/classification.hpp> #include <boost/lexical_cast.hpp> #include <boost/numeric/conversion/cast.hpp> +#include <boost/bind.hpp> #include <rtppacket.h> #include <rtpsourcedata.h> @@ -19,9 +22,24 @@ namespace Swift { -RTPSessionImpl::RTPSessionImpl(const HostAddressPort& remotePeer, PayloadType payloadType, int frequency) - : RTPSession(remotePeer, payloadType, frequency) +RTPSessionImpl::RTPSessionImpl() + : RTPSession() { +} + +RTPSessionImpl::~RTPSessionImpl() +{ +} + +void RTPSessionImpl::create(boost::shared_ptr<UDPSocket> udpSocket, const HostAddressPort &remotePeer, RTPSession::PayloadType payloadType, int frequency) +{ + this->udpSocket = udpSocket; + this->udpSocket->onDataRead.connect(boost::bind(&RTPSessionImpl::handleDataRead, this, _1)); + + this->payloadType = payloadType; + this->frequency = frequency; + nativeAddressToJRTPAddress(remotePeer, jRTPRemotePeer); + jrtplib::RTPExternalTransmissionParams transparams(&sender, 0); jrtplib::RTPSessionParams sessparams; @@ -30,15 +48,7 @@ RTPSessionImpl::RTPSessionImpl(const HostAddressPort& remotePeer, PayloadType pa checkError(session.Create(sessparams, &transparams, jrtplib::RTPTransmitter::ExternalProto)); - //session.SetDefaultPayloadType(VP8); - packetInjecter = static_cast<jrtplib::RTPExternalTransmissionInfo*>(session.GetTransmissionInfo())->GetPacketInjector(); - - nativeAddressToJRTPAddress(remotePeer, jRTPRemotePeer); -} - -RTPSessionImpl::~RTPSessionImpl() -{ } void RTPSessionImpl::poll() @@ -86,6 +96,11 @@ void RTPSessionImpl::checkError(int rtperr) const throw RTPException(jrtplib::RTPGetErrorString(rtperr)); } +void RTPSessionImpl::handleDataRead(boost::shared_ptr<SafeByteArray> data) +{ + injectData(*data); +} + void RTPSessionImpl::nativeAddressToJRTPAddress(const HostAddressPort& hostAddressPort, jrtplib::RTPIPv4Address& jRTPAddress) { // Split address |