Skip to content

Commit 1652aee

Browse files
committed
onebinary: fix global state collisions in RTSP and SDP
1 parent b58da24 commit 1652aee

File tree

3 files changed

+15
-15
lines changed

3 files changed

+15
-15
lines changed

meson.build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -224,7 +224,7 @@ onebinary_stuff += 'MistInMP3'
224224
onebinary_stuff += 'MistInMP4'
225225
onebinary_stuff += 'MistInOGG'
226226
onebinary_stuff += 'MistInPlaylist'
227-
# onebinary_stuff += 'MistInRTSP'
227+
onebinary_stuff += 'MistInRTSP'
228228
onebinary_stuff += 'MistInSDP'
229229
# onebinary_stuff += 'MistInSubRip'
230230
onebinary_stuff += 'MistInTS'

src/input/input_rtsp.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33
Mist::InputRTSP *classPointer = 0;
44
Socket::Connection *mainConn = 0;
55

6-
void incomingPacket(const DTSC::Packet &pkt){
6+
void incomingPacketRTSP(const DTSC::Packet &pkt){
77
classPointer->incoming(pkt);
88
}
9-
void insertRTP(const uint64_t track, const RTP::Packet &p){
9+
void insertRTPRTSP(const uint64_t track, const RTP::Packet &p){
1010
classPointer->incomingRTP(track, p);
1111
}
1212

@@ -15,7 +15,7 @@ void insertRTP(const uint64_t track, const RTP::Packet &p){
1515
///\param data The RTP Packet that needs to be sent
1616
///\param len The size of data
1717
///\param channel Not used here, but is kept for compatibility with sendTCP
18-
void sendUDP(void *socket, const char *data, size_t len, uint8_t channel){
18+
void sendUDPRTSP(void *socket, const char *data, size_t len, uint8_t channel){
1919
((Socket::UDPConnection *)socket)->SendNow(data, len);
2020
if (mainConn){mainConn->addUp(len);}
2121
}
@@ -31,7 +31,7 @@ namespace Mist{
3131
packetOffset = 0;
3232
TCPmode = true;
3333
sdpState.myMeta = &meta;
34-
sdpState.incomingPacketCallback = incomingPacket;
34+
sdpState.incomingPacketCallback = incomingPacketRTSP;
3535
classPointer = this;
3636
standAlone = false;
3737
seenSDP = false;
@@ -363,7 +363,7 @@ namespace Mist{
363363
for (std::map<uint64_t, SDP::Track>::iterator it = sdpState.tracks.begin();
364364
it != sdpState.tracks.end(); ++it){
365365
Socket::UDPConnection &s = it->second.data;
366-
it->second.sorter.setCallback(it->first, insertRTP);
366+
it->second.sorter.setCallback(it->first, insertRTPRTSP);
367367
while (s.Receive()){
368368
r = true;
369369
// if (s.getDestPort() != it->second.sPortA){
@@ -377,7 +377,7 @@ namespace Mist{
377377
}
378378
if (Util::bootSecs() != it->second.rtcpSent){
379379
it->second.rtcpSent = Util::bootSecs();
380-
it->second.pack.sendRTCP_RR(it->second, sendUDP);
380+
it->second.pack.sendRTCP_RR(it->second, sendUDPRTSP);
381381
}
382382
}
383383
return r;

src/input/input_sdp.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
#include "input_sdp.h"
22

33
// Will point to current InputSDP obj after constructor is called
4-
Mist::InputSDP *classPointer = 0;
4+
Mist::InputSDP *classPointerSDP = 0;
55
size_t bytesUp = 0;
66
// CB used to receive DTSC packets back from RTP sorter
7-
void incomingPacket(const DTSC::Packet &pkt){
8-
classPointer->incoming(pkt);
7+
void incomingPacketSDP(const DTSC::Packet &pkt){
8+
classPointerSDP->incoming(pkt);
99
}
1010
void insertRTP(const uint64_t track, const RTP::Packet &p){
11-
classPointer->incomingRTP(track, p);
11+
classPointerSDP->incomingRTP(track, p);
1212
}
1313

1414
/// Function used to send RTCP packets over UDP
1515
///\param socket A UDP Connection pointer, sent as a void*, to keep portability.
1616
///\param data The RTP Packet that needs to be sent
1717
///\param len The size of data
1818
///\param channel Not used here, but is kept for compatibility with sendTCP
19-
void sendUDP(void *socket, const char *data, size_t len, uint8_t channel){
19+
void sendUDPSDP(void *socket, const char *data, size_t len, uint8_t channel){
2020
((Socket::UDPConnection *)socket)->SendNow(data, len);
2121
bytesUp += len;
2222
}
@@ -30,8 +30,8 @@ namespace Mist{
3030
setPacketOffset = false;
3131
packetOffset = 0;
3232
sdpState.myMeta = &meta;
33-
sdpState.incomingPacketCallback = incomingPacket;
34-
classPointer = this;
33+
sdpState.incomingPacketCallback = incomingPacketSDP;
34+
classPointerSDP = this;
3535
standAlone = false;
3636
hasBork = false;
3737
bytesRead = 0;
@@ -280,7 +280,7 @@ namespace Mist{
280280
// Send RTCP packet back to host
281281
if (Util::bootSecs() > it->second.rtcpSent + rtcpInterval){
282282
it->second.rtcpSent = Util::bootSecs();
283-
it->second.pack.sendRTCP_RR(it->second, sendUDP);
283+
it->second.pack.sendRTCP_RR(it->second, sendUDPSDP);
284284
}
285285
}
286286
if (!receivedPacket){

0 commit comments

Comments
 (0)