Procházet zdrojové kódy

Add a configuration option to force media transport

Otherwise the media transport is not initialized if no track is defined
when initializing the PeerConnection, and dynamic calls to addTrack are
later ignored.

Co-authored-by: Nemirtingas <[email protected]>
Jonas Vautherin před 2 roky
rodič
revize
a05aaa3e5a
2 změnil soubory, kde provedl 3 přidání a 1 odebrání
  1. 1 0
      include/rtc/configuration.hpp
  2. 2 1
      src/impl/peerconnection.cpp

+ 1 - 0
include/rtc/configuration.hpp

@@ -85,6 +85,7 @@ struct RTC_CPP_EXPORT Configuration {
 	bool enableIceTcp = false;    // libnice only
 	bool enableIceUdpMux = false; // libjuice only
 	bool disableAutoNegotiation = false;
+	bool forceMediaTransport = false;
 
 	// Port range
 	uint16_t portRangeBegin = 1024;

+ 2 - 1
src/impl/peerconnection.cpp

@@ -239,7 +239,8 @@ shared_ptr<DtlsTransport> PeerConnection::initDtlsTransport() {
 		    };
 
 		shared_ptr<DtlsTransport> transport;
-		if (auto local = localDescription(); local && local->hasAudioOrVideo()) {
+		auto local = localDescription();
+		if (config.forceMediaTransport || (local && local->hasAudioOrVideo())) {
 #if RTC_ENABLE_MEDIA
 			PLOG_INFO << "This connection requires media support";