summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
Diffstat (limited to 'Swiften/ScreenSharing/OutgoingScreenSharing.cpp')
-rw-r--r--Swiften/ScreenSharing/OutgoingScreenSharing.cpp18
1 files changed, 11 insertions, 7 deletions
diff --git a/Swiften/ScreenSharing/OutgoingScreenSharing.cpp b/Swiften/ScreenSharing/OutgoingScreenSharing.cpp
index 3aa460c..da7eb3e 100644
--- a/Swiften/ScreenSharing/OutgoingScreenSharing.cpp
+++ b/Swiften/ScreenSharing/OutgoingScreenSharing.cpp
@@ -13,6 +13,7 @@
#include <Swiften/Network/UDPSocket.h>
#include <Swiften/Network/TimerFactory.h>
#include <Swiften/Network/Timer.h>
+#include <Swiften/ScreenSharing/RTPSessionImpl.h>
#include <boost/bind.hpp>
@@ -21,8 +22,9 @@ namespace Swift {
OutgoingScreenSharing::OutgoingScreenSharing(boost::shared_ptr<JingleSession> session, UDPSocketFactory* udpSocketFactory, TimerFactory* timerFactory)
: ScreenSharing(session, udpSocketFactory),
contentID(JingleContentID(idGenerator.generateID(), JingleContentPayload::InitiatorCreator)), canceled(false),
- sessionAccepted(false), socketConnected(false), timerFactory(timerFactory)
+ sessionAccepted(false), socketConnected(false), rtpSession(0), timerFactory(timerFactory)
{
+ session->onSessionAcceptReceived.connect(boost::bind(&OutgoingScreenSharing::handleSessionAcceptReceived, this, _1, _2, _3));
}
OutgoingScreenSharing::~OutgoingScreenSharing()
@@ -43,7 +45,8 @@ void OutgoingScreenSharing::start()
SWIFT_LOG(debug) << "Screen sharing: start" << std::endl;
JingleRTPDescription::ref desc = boost::make_shared<JingleRTPDescription>(JingleRTPDescription::Video);
- desc->addPayloadType(RTPPayloadType(98, "VP8", 90000));
+ payloadTypeUsed = RTPPayloadType(98, "VP8", 90000);
+ desc->addPayloadType(payloadTypeUsed);
JingleRawUDPTransportPayload::ref transport = boost::make_shared<JingleRawUDPTransportPayload>();
addBestCandidate(transport);
@@ -57,10 +60,9 @@ void OutgoingScreenSharing::start()
void OutgoingScreenSharing::handleSocketConnected()
{
- SWIFT_LOG(debug) << "Screen sharing: UDP socket connected" << std::endl;
-
if (canceled)
return;
+ SWIFT_LOG(debug) << "Screen sharing: UDP socket connected" << std::endl;
socketConnected = true;
if (sessionAccepted)
@@ -69,10 +71,11 @@ void OutgoingScreenSharing::handleSocketConnected()
void OutgoingScreenSharing::handleSessionAcceptReceived(const JingleContentID& /*id*/, boost::shared_ptr<JingleDescription> /*desc*/, boost::shared_ptr<JingleTransportPayload> /*transport*/)
{
- SWIFT_LOG(debug) << "Screen sharing: accepted" << std::endl;
-
if (canceled)
return;
+ SWIFT_LOG(debug) << "Screen sharing: accepted" << std::endl;
+
+ // TODO: check desc and transport
sessionAccepted = true;
if (socketConnected) {
@@ -97,9 +100,10 @@ void OutgoingScreenSharing::handleConnectionFailed()
void OutgoingScreenSharing::startRTPSession()
{
- SWIFT_LOG(debug) << "Screen sharing: accepted and connect, start screen sharing" << std::endl;
+ SWIFT_LOG(debug) << "Screen sharing: accepted and connected, start sharing" << std::endl;
// Session accepted and socket connected, we can start the rtp session
+ rtpSession = new RTPSessionImpl(serverSocket, payloadTypeUsed);
}
}