Commit 83bf6c7368013a2165859bdd9ca9ed59ebcca069
1 parent
a1e0e935
端口范围可配置
Showing
1 changed file
with
5 additions
and
3 deletions
src/decoder/gb28181/rtp/RTPReceiver.cpp
@@ -3,6 +3,7 @@ | @@ -3,6 +3,7 @@ | ||
3 | #include <thread> | 3 | #include <thread> |
4 | 4 | ||
5 | #include "../common_header.h" | 5 | #include "../common_header.h" |
6 | +#include "../sip/SipServer.h" | ||
6 | 7 | ||
7 | #ifdef __linux__ | 8 | #ifdef __linux__ |
8 | #include "arpa/inet.h" | 9 | #include "arpa/inet.h" |
@@ -12,9 +13,6 @@ | @@ -12,9 +13,6 @@ | ||
12 | 13 | ||
13 | const int kVideoFrameSize = BUFFERSIZE_1024*BUFFERSIZE_1024*5*2; | 14 | const int kVideoFrameSize = BUFFERSIZE_1024*BUFFERSIZE_1024*5*2; |
14 | 15 | ||
15 | -const int MIN_RTP_PORT = 10000 ; | ||
16 | -const int MAX_RTP_PORT = 60000; | ||
17 | - | ||
18 | // PS解包器回调 | 16 | // PS解包器回调 |
19 | static int ReceivePESFunction(unsigned char streamid, void * data, int size, uint64_t pts, uint64_t localPts, bool key, void* param) | 17 | static int ReceivePESFunction(unsigned char streamid, void * data, int size, uint64_t pts, uint64_t localPts, bool key, void* param) |
20 | { | 18 | { |
@@ -312,6 +310,10 @@ int RTPReceiver::ParsePacket(RTPPacket* packet){ | @@ -312,6 +310,10 @@ int RTPReceiver::ParsePacket(RTPPacket* packet){ | ||
312 | 310 | ||
313 | int RTPReceiver::allocRtpPort() { | 311 | int RTPReceiver::allocRtpPort() { |
314 | 312 | ||
313 | + SipServer* pServer = SipServer::getInstance(); | ||
314 | + int MIN_RTP_PORT = pServer->GetMinRtpPort() ; | ||
315 | + int MAX_RTP_PORT = pServer->GetMaxRtpPort(); | ||
316 | + | ||
315 | int s_rtpPort = MIN_RTP_PORT; | 317 | int s_rtpPort = MIN_RTP_PORT; |
316 | 318 | ||
317 | srand((unsigned int)time(NULL)); | 319 | srand((unsigned int)time(NULL)); |