Made RTSP max send value runtime configurable.
This commit is contained in:
		
							parent
							
								
									39fd36db04
								
							
						
					
					
						commit
						de1d202457
					
				
					 3 changed files with 17 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -3,10 +3,10 @@
 | 
			
		|||
#include "timing.h"
 | 
			
		||||
#include "defines.h"
 | 
			
		||||
 | 
			
		||||
#define MAX_SEND 1024*4
 | 
			
		||||
 | 
			
		||||
namespace RTP {
 | 
			
		||||
  double Packet::startRTCP = 0;
 | 
			
		||||
  unsigned int MAX_SEND = 4*1024;
 | 
			
		||||
 | 
			
		||||
  unsigned int Packet::getHsize() const {
 | 
			
		||||
    return 12 + 4 * getContribCount();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -18,6 +18,8 @@
 | 
			
		|||
/// This namespace holds all RTP-parsing and sending related functionality.
 | 
			
		||||
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.
 | 
			
		||||
  class Packet {
 | 
			
		||||
    private:
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -51,6 +51,19 @@ namespace Mist {
 | 
			
		|||
    capa["methods"][0u]["handler"] = "rtsp";
 | 
			
		||||
    capa["methods"][0u]["type"] = "rtsp";
 | 
			
		||||
    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);
 | 
			
		||||
    config = cfg;
 | 
			
		||||
| 
						 | 
				
			
			@ -122,6 +135,7 @@ namespace Mist {
 | 
			
		|||
  }
 | 
			
		||||
 | 
			
		||||
  void OutRTSP::onRequest(){
 | 
			
		||||
    RTP::MAX_SEND = config->getInteger("maxsend");
 | 
			
		||||
    while (HTTP_R.Read(myConn)){
 | 
			
		||||
      HTTP_S.Clean();
 | 
			
		||||
      HTTP_S.protocol = "RTSP/1.0";
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue