فهرست منبع

Fixed track open callback

Paul-Louis Ageneau 4 سال پیش
والد
کامیت
649a5d0e88
3فایلهای تغییر یافته به همراه7 افزوده شده و 9 حذف شده
  1. 3 5
      src/description.cpp
  2. 0 3
      src/peerconnection.cpp
  3. 4 1
      src/track.cpp

+ 3 - 5
src/description.cpp

@@ -496,15 +496,10 @@ Description::Media::Media(const string &sdp) : Entry(sdp, "", Direction::Unknown
 
 	if (mid().empty())
 		throw std::invalid_argument("Missing mid in media SDP");
-
-	if (std::find(mAttributes.begin(), mAttributes.end(), "rtcp-mux") == mAttributes.end())
-		mAttributes.emplace_back("rtcp-mux");
 }
 
 Description::Media::Media(const string &mline, string mid, Direction dir)
     : Entry(mline, std::move(mid), dir) {
-
-	mAttributes.emplace_back("rtcp-mux");
 }
 
 string Description::Media::description() const {
@@ -616,6 +611,7 @@ string Description::Media::generateSdpLines(string_view eol) const {
 		sdp << "b=AS:" << mBas << eol;
 
 	sdp << Entry::generateSdpLines(eol);
+	sdp << "a=rtcp-mux" << eol;
 
 	for (auto it = mRtpMap.begin(); it != mRtpMap.end(); ++it) {
 		auto &map = it->second;
@@ -662,6 +658,8 @@ void Description::Media::parseSdpLine(string_view line) {
 			} else {
 				it->second.fmtps.emplace_back(value.substr(p + 1));
 			}
+		} else if (key == "rtcp-mux") {
+			// always added
 		} else {
 			Entry::parseSdpLine(line);
 		}

+ 0 - 3
src/peerconnection.cpp

@@ -685,9 +685,6 @@ void PeerConnection::incomingTrack(Description::Media description) {
 
 void PeerConnection::openTracks() {
 #if RTC_ENABLE_MEDIA
-	if (!hasMedia())
-		return;
-
 	if (auto transport = std::atomic_load(&mDtlsTransport)) {
 		auto srtpTransport = std::reinterpret_pointer_cast<DtlsSrtpTransport>(transport);
 		std::shared_lock lock(mTracksMutex); // read-only

+ 4 - 1
src/track.cpp

@@ -70,7 +70,10 @@ size_t Track::availableAmount() const {
 }
 
 #if RTC_ENABLE_MEDIA
-void Track::open(shared_ptr<DtlsSrtpTransport> transport) { mDtlsSrtpTransport = transport; }
+void Track::open(shared_ptr<DtlsSrtpTransport> transport) {
+	mDtlsSrtpTransport = transport;
+	triggerOpen();
+}
 #endif
 
 bool Track::outgoing(message_ptr message) {