diff options
| author | dknn <yoann.blein@free.fr> | 2012-07-16 12:00:56 (GMT) |
|---|---|---|
| committer | dknn <yoann.blein@free.fr> | 2012-09-22 09:01:49 (GMT) |
| commit | 292967c02ffc2ff0b53df526af2965a03916290c (patch) | |
| tree | 6712ee7c70d4a68af1cd7e46f6929f4bfce2f27d /Swiften/ScreenSharing/OutgoingScreenSharing.cpp | |
| parent | 05ef8661b2f42cc5b889f3900b459d8a49a24db3 (diff) | |
| download | swift-contrib-292967c02ffc2ff0b53df526af2965a03916290c.zip swift-contrib-292967c02ffc2ff0b53df526af2965a03916290c.tar.bz2 | |
Better handling of udp bind errors
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 @@ -49,25 +49,27 @@ 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; JingleRTPDescription::ref desc = boost::make_shared<JingleRTPDescription>(JingleRTPDescription::Video); payloadTypeUsed = RTPPayloadType(98, "VP8", 90000); 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) { |
Swift