Browse Source

Merge pull request #748 from paullouisageneau/capi-forcemediatransport

Add configuration option to force media transport in C API
Paul-Louis Ageneau 2 years ago
parent
commit
47a3a86220
4 changed files with 6 additions and 0 deletions
  1. 2 0
      DOC.md
  2. 1 0
      include/rtc/rtc.h
  3. 2 0
      pages/content/pages/reference.md
  4. 1 0
      src/capi.cpp

+ 2 - 0
DOC.md

@@ -84,6 +84,7 @@ typedef struct {
 	bool enableIceTcp;
 	bool enableIceTcp;
 	bool enableIceUdpMux;
 	bool enableIceUdpMux;
 	bool disableAutoNegotiation;
 	bool disableAutoNegotiation;
+	bool forceMediaTransport;
 	uint16_t portRangeBegin;
 	uint16_t portRangeBegin;
 	uint16_t portRangeEnd;
 	uint16_t portRangeEnd;
 	int mtu;
 	int mtu;
@@ -105,6 +106,7 @@ Arguments:
   - `enableIceTcp`: if true, generate TCP candidates for ICE (ignored with libjuice as ICE backend)
   - `enableIceTcp`: if true, generate TCP candidates for ICE (ignored with libjuice as ICE backend)
   - `enableIceUdpMux`: if true, connections are multiplexed on the same UDP port (should be combined with `portRangeBegin` and `portRangeEnd`, ignored with libnice as ICE backend)
   - `enableIceUdpMux`: if true, connections are multiplexed on the same UDP port (should be combined with `portRangeBegin` and `portRangeEnd`, ignored with libnice as ICE backend)
   - `disableAutoNegotiation`: if true, the user is responsible for calling `rtcSetLocalDescription` after creating a Data Channel and after setting the remote description
   - `disableAutoNegotiation`: if true, the user is responsible for calling `rtcSetLocalDescription` after creating a Data Channel and after setting the remote description
+  - `forceMediaTransport`: if true, the connection allocates the SRTP media transport even if no tracks are present (necessary to add tracks during later renegotiation)
   - `portRangeBegin` (optional): first port (included) of the allowed local port range (0 if unused)
   - `portRangeBegin` (optional): first port (included) of the allowed local port range (0 if unused)
   - `portRangeEnd` (optional): last port (included) of the allowed local port (0 if unused)
   - `portRangeEnd` (optional): last port (included) of the allowed local port (0 if unused)
   - `mtu` (optional): manually set the Maximum Transfer Unit (MTU) for the connection (0 if automatic)
   - `mtu` (optional): manually set the Maximum Transfer Unit (MTU) for the connection (0 if automatic)

+ 1 - 0
include/rtc/rtc.h

@@ -159,6 +159,7 @@ typedef struct {
 	bool enableIceTcp;    // libnice only
 	bool enableIceTcp;    // libnice only
 	bool enableIceUdpMux; // libjuice only
 	bool enableIceUdpMux; // libjuice only
 	bool disableAutoNegotiation;
 	bool disableAutoNegotiation;
+	bool forceMediaTransport;
 	uint16_t portRangeBegin; // 0 means automatic
 	uint16_t portRangeBegin; // 0 means automatic
 	uint16_t portRangeEnd;   // 0 means automatic
 	uint16_t portRangeEnd;   // 0 means automatic
 	int mtu;                 // <= 0 means automatic
 	int mtu;                 // <= 0 means automatic

+ 2 - 0
pages/content/pages/reference.md

@@ -87,6 +87,7 @@ typedef struct {
 	bool enableIceTcp;
 	bool enableIceTcp;
 	bool enableIceUdpMux;
 	bool enableIceUdpMux;
 	bool disableAutoNegotiation;
 	bool disableAutoNegotiation;
+	bool forceMediaTransport;
 	uint16_t portRangeBegin;
 	uint16_t portRangeBegin;
 	uint16_t portRangeEnd;
 	uint16_t portRangeEnd;
 	int mtu;
 	int mtu;
@@ -108,6 +109,7 @@ Arguments:
   - `enableIceTcp`: if true, generate TCP candidates for ICE (ignored with libjuice as ICE backend)
   - `enableIceTcp`: if true, generate TCP candidates for ICE (ignored with libjuice as ICE backend)
   - `enableIceUdpMux`: if true, connections are multiplexed on the same UDP port (should be combined with `portRangeBegin` and `portRangeEnd`, ignored with libnice as ICE backend)
   - `enableIceUdpMux`: if true, connections are multiplexed on the same UDP port (should be combined with `portRangeBegin` and `portRangeEnd`, ignored with libnice as ICE backend)
   - `disableAutoNegotiation`: if true, the user is responsible for calling `rtcSetLocalDescription` after creating a Data Channel and after setting the remote description
   - `disableAutoNegotiation`: if true, the user is responsible for calling `rtcSetLocalDescription` after creating a Data Channel and after setting the remote description
+  - `forceMediaTransport`: if true, the connection allocates the SRTP media transport even if no tracks are present (necessary to add tracks during later renegotiation)
   - `portRangeBegin` (optional): first port (included) of the allowed local port range (0 if unused)
   - `portRangeBegin` (optional): first port (included) of the allowed local port range (0 if unused)
   - `portRangeEnd` (optional): last port (included) of the allowed local port (0 if unused)
   - `portRangeEnd` (optional): last port (included) of the allowed local port (0 if unused)
   - `mtu` (optional): manually set the Maximum Transfer Unit (MTU) for the connection (0 if automatic)
   - `mtu` (optional): manually set the Maximum Transfer Unit (MTU) for the connection (0 if automatic)

+ 1 - 0
src/capi.cpp

@@ -395,6 +395,7 @@ int rtcCreatePeerConnection(const rtcConfiguration *config) {
 		c.enableIceTcp = config->enableIceTcp;
 		c.enableIceTcp = config->enableIceTcp;
 		c.enableIceUdpMux = config->enableIceUdpMux;
 		c.enableIceUdpMux = config->enableIceUdpMux;
 		c.disableAutoNegotiation = config->disableAutoNegotiation;
 		c.disableAutoNegotiation = config->disableAutoNegotiation;
+		c.forceMediaTransport = config->forceMediaTransport;
 
 
 		if (config->mtu > 0)
 		if (config->mtu > 0)
 			c.mtu = size_t(config->mtu);
 			c.mtu = size_t(config->mtu);