Browse Source

Merge branch 'api_updates' of https://github.com/stazio/libdatachannel into api_updates

Staz M 4 years ago
parent
commit
496163dbbe
2 changed files with 19 additions and 6 deletions
  1. 13 3
      src/description.cpp
  2. 6 3
      src/dtlssrtptransport.cpp

+ 13 - 3
src/description.cpp

@@ -613,17 +613,27 @@ void Description::Media::removeFormat(const string &fmt) {
 
 void Description::Video::addVideoCodec(int payloadType, const string &codec) {
 	RTPMap map(std::to_string(payloadType) + ' ' + codec + "/90000");
-    map.addFB("nack");
-    map.addFB("nack pli");
+        map.addFB("nack");
+	    map.addFB("nack pli");
 	map.addFB("goog-remb");
 	if (codec == "H264") {
 		// Use Constrained Baseline profile Level 4.2 (necessary for Firefox)
 		// https://developer.mozilla.org/en-US/docs/Web/Media/Formats/WebRTC_codecs#Supported_video_codecs
 		// TODO: Should be 42E0 but 42C0 appears to be more compatible. Investigate this.
-		map.fmtps.emplace_back("profile-level-id=42E02A;packetization-mode=1;level-asymmetry-allowed=1");
+		map.fmtps.emplace_back("profile-level-id=4de01f;packetization-mode=1;level-asymmetry-allowed=1");
+		
+		// Because certain Android devices don't like me, let us just negotiate some random
+		{
+			RTPMap map(std::to_string(payloadType+1) + ' ' + codec + "/90000");
+			map.addFB("nack");
+			    map.addFB("nack pli");
+			map.addFB("goog-remb");
+			addRTPMap(map);
+			}
 	}
 	addRTPMap(map);
 
+
 //	// RTX Packets
 /* TODO
  *  TIL that Firefox does not properly support the negotiation of RTX! It works, but doesn't negotiate the SSRC so

+ 6 - 3
src/dtlssrtptransport.cpp

@@ -116,9 +116,10 @@ bool DtlsSrtpTransport::sendMedia(message_ptr message) {
                 if ((err = srtp_protect_rtcp(mSrtpOut, message->data(), &size)))
                     throw std::runtime_error("SRTCP protect error, status=" +
                                              to_string(static_cast<int>(err)));
-            }else
-				throw std::runtime_error("SRTCP protect error, status=" +
-				                         to_string(static_cast<int>(err)));
+            }else {
+		throw std::runtime_error("SRTCP protect error, status=" +
+					 to_string(static_cast<int>(err)));
+	    }
 		}
 		PLOG_VERBOSE << "Protected SRTCP packet, size=" << size;
 	} else {
@@ -327,6 +328,7 @@ void DtlsSrtpTransport::addSSRC(uint32_t ssrc) {
     inbound.ssrc.value = ssrc;
     inbound.key = mIsClient ? mServerSessionKey : mClientSessionKey;
     inbound.next = nullptr;
+    inbound.allow_repeat_tx = true;
 
     if (srtp_err_status_t err = srtp_add_stream(mSrtpIn, &inbound))
         throw std::runtime_error("SRTP add inbound stream failed, status=" +
@@ -339,6 +341,7 @@ void DtlsSrtpTransport::addSSRC(uint32_t ssrc) {
     outbound.ssrc.value = ssrc;
     outbound.key = mIsClient ? mClientSessionKey : mServerSessionKey;
     outbound.next = nullptr;
+    outbound.allow_repeat_tx = true;
 
     if (srtp_err_status_t err = srtp_add_stream(mSrtpOut, &outbound))
         throw std::runtime_error("SRTP add outbound stream failed, status=" +