Made RTSP max send value runtime configurable.

This commit is contained in:
Thulinma 2015-10-14 14:30:28 +02:00
parent 39fd36db04
commit de1d202457
3 changed files with 17 additions and 1 deletions

View file

@ -3,10 +3,10 @@
#include "timing.h" #include "timing.h"
#include "defines.h" #include "defines.h"
#define MAX_SEND 1024*4
namespace RTP { namespace RTP {
double Packet::startRTCP = 0; double Packet::startRTCP = 0;
unsigned int MAX_SEND = 4*1024;
unsigned int Packet::getHsize() const { unsigned int Packet::getHsize() const {
return 12 + 4 * getContribCount(); return 12 + 4 * getContribCount();

View file

@ -18,6 +18,8 @@
/// This namespace holds all RTP-parsing and sending related functionality. /// This namespace holds all RTP-parsing and sending related functionality.
namespace RTP { namespace RTP {
extern unsigned int MAX_SEND;
/// This class is used to make RTP packets. Currently, H264, and AAC are supported. RTP mechanisms, like increasing sequence numbers and setting timestamps are all taken care of in here. /// This class is used to make RTP packets. Currently, H264, and AAC are supported. RTP mechanisms, like increasing sequence numbers and setting timestamps are all taken care of in here.
class Packet { class Packet {
private: private:

View file

@ -51,6 +51,19 @@ namespace Mist {
capa["methods"][0u]["handler"] = "rtsp"; capa["methods"][0u]["handler"] = "rtsp";
capa["methods"][0u]["type"] = "rtsp"; capa["methods"][0u]["type"] = "rtsp";
capa["methods"][0u]["priority"] = 2ll; capa["methods"][0u]["priority"] = 2ll;
JSON::Value maxsend_opt;
maxsend_opt["arg"] = "integer";
maxsend_opt["default"] = (long long)RTP::MAX_SEND;
maxsend_opt["short"] = "m";
maxsend_opt["long"] = "max-packet-size";
maxsend_opt["help"] = "Maximum size of RTP packets in bytes";
cfg->addOption("maxsend", maxsend_opt);
capa["optional"]["maxsend"]["name"] = "Max RTP packet size";
capa["optional"]["maxsend"]["help"] = "Maximum size of RTP packets in bytes";
capa["optional"]["maxsend"]["default"] = (long long)RTP::MAX_SEND;
capa["optional"]["maxsend"]["type"] = "uint";
capa["optional"]["maxsend"]["option"] = "--max-packet-size";
cfg->addConnectorOptions(554, capa); cfg->addConnectorOptions(554, capa);
config = cfg; config = cfg;
@ -122,6 +135,7 @@ namespace Mist {
} }
void OutRTSP::onRequest(){ void OutRTSP::onRequest(){
RTP::MAX_SEND = config->getInteger("maxsend");
while (HTTP_R.Read(myConn)){ while (HTTP_R.Read(myConn)){
HTTP_S.Clean(); HTTP_S.Clean();
HTTP_S.protocol = "RTSP/1.0"; HTTP_S.protocol = "RTSP/1.0";