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
@@ -12,18 +12,20 @@
#include <Swiften/Jingle/JingleSession.h>
#include <Swiften/Network/UDPSocket.h>
#include <Swiften/Network/TimerFactory.h>
#include <Swiften/Network/Timer.h>
+#include <Swiften/ScreenSharing/RTPSessionImpl.h>
#include <boost/bind.hpp>
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()
{
@@ -42,9 +44,10 @@ void OutgoingScreenSharing::start()
//onStateChange(ScreenSharing::WaitingForStart);
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);
@@ -56,24 +59,24 @@ 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)
startRTPSession();
}
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) {
startRTPSession();
@@ -96,10 +99,11 @@ 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);
}
}