diff options
Diffstat (limited to 'Swiften/ScreenSharing/OutgoingScreenSharing.cpp')
-rw-r--r-- | Swiften/ScreenSharing/OutgoingScreenSharing.cpp | 20 |
1 files changed, 11 insertions, 9 deletions
diff --git a/Swiften/ScreenSharing/OutgoingScreenSharing.cpp b/Swiften/ScreenSharing/OutgoingScreenSharing.cpp index 906bd68..005e204 100644 --- a/Swiften/ScreenSharing/OutgoingScreenSharing.cpp +++ b/Swiften/ScreenSharing/OutgoingScreenSharing.cpp @@ -50,8 +50,6 @@ void OutgoingScreenSharing::cancel() void OutgoingScreenSharing::start(unsigned int width, unsigned int height) { //onStateChange(ScreenSharing::WaitingForStart); - SWIFT_LOG(debug) << "Screen sharing: start" << std::endl; - this->width = width; this->height = height; @@ -60,13 +58,17 @@ void OutgoingScreenSharing::start(unsigned int width, unsigned int height) desc->addPayloadType(payloadTypeUsed); JingleRawUDPTransportPayload::ref transport = boost::make_shared<JingleRawUDPTransportPayload>(); - addBestCandidate(transport); - - jingleSession->sendInitiate(contentID, desc, transport); - onStateChange(ScreenSharing::WaitingForAccept); - - serverSocket->onConnected.connect(boost::bind(&OutgoingScreenSharing::handleSocketConnected, this)); - serverSocket->connectToFirstIncoming(); + if (addBestCandidate(transport)) { + SWIFT_LOG(debug) << "Screen sharing: start" << std::endl; + jingleSession->sendInitiate(contentID, desc, transport); + serverSocket->onConnected.connect(boost::bind(&OutgoingScreenSharing::handleSocketConnected, this)); + serverSocket->connectToFirstIncoming(); + onStateChange(ScreenSharing::WaitingForAccept); + } else { + SWIFT_LOG(error) << "Screen sharing: Unable to listening on any interface" << std::endl; + onStateChange(ScreenSharing::Failed); + onFinished(); + } } void OutgoingScreenSharing::addImage(const Image &image) |