瀏覽代碼

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 2 年之前
父節點
當前提交
a05aaa3e5a
共有 2 個文件被更改,包括 3 次插入1 次删除
  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";