blob: 657a34af9bfdc0335a631a4850f2e25699742fbe (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
|
/*
* Copyright (c) 2012 Yoann Blein
* Licensed under the simplified BSD license.
* See Documentation/Licenses/BSD-simplified.txt for more information.
*/
#pragma once
#include <Swiften/ScreenSharing/RTPSession.h>
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wunused-parameter"
#include <rtpsession.h>
#pragma clang diagnostic pop
#include <rtpexternaltransmitter.h>
#include <rtpipv4address.h>
namespace Swift {
// Temporary class
class Sender : public jrtplib::RTPExternalSender
{
public:
Sender() {}
virtual bool SendRTP (const void* /*data*/, size_t /*len*/)
{
return true;
}
virtual bool SendRTCP (const void* /*data*/, size_t /*len*/)
{
return true;
}
virtual bool ComesFromThisSender (const jrtplib::RTPAddress* /*address*/)
{
return false;
}
};
class RTPSessionImpl : public RTPSession {
public:
typedef boost::shared_ptr<RTPSession> ref;
public:
RTPSessionImpl();
virtual ~RTPSessionImpl();
virtual void create(boost::shared_ptr<UDPSocket> udpSocket, const HostAddressPort &remotePeer, PayloadType payloadType, int frequency);
virtual void poll();
virtual void checkIncomingPackets();
virtual void sendPacket(const SafeByteArray &data, int timestampinc, bool marker = false);
virtual void injectData(const SafeByteArray &data);
virtual void stop(int maxWaitMs = 100);
private:
static void nativeAddressToJRTPAddress(const HostAddressPort& hostAddressPort, jrtplib::RTPIPv4Address& jRTPAddress);
private:
inline void checkError(int rtperr) const;
void handleDataRead(boost::shared_ptr<SafeByteArray> data);
private:
boost::shared_ptr<UDPSocket> udpSocket;
PayloadType payloadType;
int frequency;
jrtplib::RTPIPv4Address jRTPRemotePeer;
jrtplib::RTPSession session;
Sender sender;
jrtplib::RTPExternalPacketInjecter *packetInjecter;
};
}
|