summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authordknn <yoann.blein@free.fr>2012-07-15 16:18:18 (GMT)
committerdknn <yoann.blein@free.fr>2012-09-22 09:01:49 (GMT)
commitc9ba8e43fc23fccd47531ecea73224b3b9b552c3 (patch)
tree9d9953000cc4d76e798cd1967e8f1e76ff102100
parent70e395802de55b1d2eb9f92ad86349cd2d0d0575 (diff)
downloadswift-contrib-c9ba8e43fc23fccd47531ecea73224b3b9b552c3.zip
swift-contrib-c9ba8e43fc23fccd47531ecea73224b3b9b552c3.tar.bz2
Fix troubles in screen sharing example
-rw-r--r--Swiften/Examples/ScreenSharing/Host.cpp5
-rw-r--r--Swiften/ScreenSharing/OutgoingScreenSharing.cpp1
-rw-r--r--Swiften/ScreenSharing/RTPSession.h2
-rw-r--r--Swiften/ScreenSharing/RTPSessionImpl.cpp10
-rw-r--r--Swiften/ScreenSharing/RTPSessionImpl.h2
-rw-r--r--Swiften/ScreenSharing/VP8RTPPacketizer.h2
6 files changed, 17 insertions, 5 deletions
diff --git a/Swiften/Examples/ScreenSharing/Host.cpp b/Swiften/Examples/ScreenSharing/Host.cpp
index 44f72d4..5d67de0 100644
--- a/Swiften/Examples/ScreenSharing/Host.cpp
+++ b/Swiften/Examples/ScreenSharing/Host.cpp
@@ -78,6 +78,7 @@ class ScreenSharer {
outgoingScreenSharing = client->getScreenSharingManager()->createOutgoingScreenSharing(recipient);
if (outgoingScreenSharing) {
+ client->getEntityCapsProvider()->onCapsChanged.disconnect(boost::bind(&ScreenSharer::handleCapsChanged, this, _1));
std::cout << "started screen sharing" << std::endl;
outgoingScreenSharing->onReady.connect(boost::bind(&ScreenSharer::handleRTPReady, this));
outgoingScreenSharing->onFinished.connect(boost::bind(&ScreenSharer::handleScreenSharingFinished, this));
@@ -90,11 +91,11 @@ class ScreenSharer {
}
void handleRTPReady() {
- uint8_t *data = new uint8_t[200*200*3];
+ uint8_t data[200*200*3];
data[0] = 0;
data[1] = 128;
data[2] = 255;
- Image img(200, 200, data);
+ Image img(200, 200, (const uint8_t*)data);
for (int i = 0; i < 10; ++i)
outgoingScreenSharing->addImage(img);
outgoingScreenSharing->stop();
diff --git a/Swiften/ScreenSharing/OutgoingScreenSharing.cpp b/Swiften/ScreenSharing/OutgoingScreenSharing.cpp
index ec0a39c..906bd68 100644
--- a/Swiften/ScreenSharing/OutgoingScreenSharing.cpp
+++ b/Swiften/ScreenSharing/OutgoingScreenSharing.cpp
@@ -65,6 +65,7 @@ void OutgoingScreenSharing::start(unsigned int width, unsigned int height)
jingleSession->sendInitiate(contentID, desc, transport);
onStateChange(ScreenSharing::WaitingForAccept);
+ serverSocket->onConnected.connect(boost::bind(&OutgoingScreenSharing::handleSocketConnected, this));
serverSocket->connectToFirstIncoming();
}
diff --git a/Swiften/ScreenSharing/RTPSession.h b/Swiften/ScreenSharing/RTPSession.h
index 4399b2d..e4aa9c1 100644
--- a/Swiften/ScreenSharing/RTPSession.h
+++ b/Swiften/ScreenSharing/RTPSession.h
@@ -29,6 +29,8 @@ namespace Swift {
virtual void injectData(const SafeByteArray& data) = 0;
virtual void stop(int maxWaitMs = 100) = 0;
+ virtual size_t getMaxRTPPayloadSize() const = 0;
+
public:
boost::signal<void (uint8_t* data, size_t len, bool marker)> onIncomingPacket;
};
diff --git a/Swiften/ScreenSharing/RTPSessionImpl.cpp b/Swiften/ScreenSharing/RTPSessionImpl.cpp
index 94641ff..bbd3d72 100644
--- a/Swiften/ScreenSharing/RTPSessionImpl.cpp
+++ b/Swiften/ScreenSharing/RTPSessionImpl.cpp
@@ -88,13 +88,13 @@ void RTPSessionImpl::checkIncomingPackets()
void RTPSessionImpl::sendPacket(const SafeByteArray& data, int timestampinc, bool marker)
{
- checkError(session.SendPacket((void*)(&data[0]), data.size(), payloadType.getID(), marker, timestampinc));
+ checkError(session.SendPacket((void*)(data.data()), data.size(), payloadType.getID(), marker, timestampinc));
poll();
}
void RTPSessionImpl::injectData(const SafeByteArray& data)
{
- packetInjecter->InjectRTPorRTCP((void*)(&data[0]), data.size(), jRTPRemotePeer);
+ packetInjecter->InjectRTPorRTCP((void*)(data.data()), data.size(), jRTPRemotePeer);
checkIncomingPackets();
poll();
}
@@ -105,6 +105,12 @@ void RTPSessionImpl::stop(int maxWaitMs)
udpSocket->close();
}
+size_t RTPSessionImpl::getMaxRTPPayloadSize() const
+{
+ jrtplib::RTPSessionParams sessparams;
+ return sessparams.GetMaximumPacketSize();
+}
+
void RTPSessionImpl::checkError(int rtperr) const
{
if (rtperr < 0)
diff --git a/Swiften/ScreenSharing/RTPSessionImpl.h b/Swiften/ScreenSharing/RTPSessionImpl.h
index 231ec1e..2c6fed2 100644
--- a/Swiften/ScreenSharing/RTPSessionImpl.h
+++ b/Swiften/ScreenSharing/RTPSessionImpl.h
@@ -46,6 +46,8 @@ namespace Swift {
virtual void injectData(const SafeByteArray &data);
virtual void stop(int maxWaitMs = 100);
+ virtual size_t getMaxRTPPayloadSize() const;
+
public:
static jrtplib::RTPIPv4Address nativeAddressToJRTPAddress(const HostAddressPort& hostAddressPort);
diff --git a/Swiften/ScreenSharing/VP8RTPPacketizer.h b/Swiften/ScreenSharing/VP8RTPPacketizer.h
index d5343c0..c56e754 100644
--- a/Swiften/ScreenSharing/VP8RTPPacketizer.h
+++ b/Swiften/ScreenSharing/VP8RTPPacketizer.h
@@ -29,7 +29,7 @@ namespace Swift {
static const uint8_t HBit = 1 << 4;
static const uint8_t Size0BitMask = 7;
static const uint8_t Size0BitShift = 5;
- static const size_t MaxRTPPayloadSize = 1400; // Replace with JRTPLIB's one
+ static const size_t MaxRTPPayloadSize = 1300; // Replace with JRTPLIB's one; TODO: fix the issue with maximum size
std::vector<uint8_t> payloadBuffer;
};