Browse Source

Merge pull request #984 from murat-dogan/master

Expose remoteMaxMessageSize on peer-connection
Paul-Louis Ageneau 1 year ago
parent
commit
eff641352e
4 changed files with 12 additions and 0 deletions
  1. 1 0
      include/rtc/peerconnection.hpp
  2. 2 0
      include/rtc/rtc.h
  3. 7 0
      src/capi.cpp
  4. 2 0
      src/peerconnection.cpp

+ 1 - 0
include/rtc/peerconnection.hpp

@@ -84,6 +84,7 @@ public:
 	bool hasMedia() const;
 	optional<Description> localDescription() const;
 	optional<Description> remoteDescription() const;
+	size_t remoteMaxMessageSize() const;
 	optional<string> localAddress() const;
 	optional<string> remoteAddress() const;
 	uint16_t maxDataChannelId() const;

+ 2 - 0
include/rtc/rtc.h

@@ -214,6 +214,8 @@ RTC_C_EXPORT int rtcGetSelectedCandidatePair(int pc, char *local, int localSize,
 
 RTC_C_EXPORT int rtcGetMaxDataChannelStream(int pc);
 
+RTC_C_EXPORT int rtcGetRemoteMaxMessageSize(int pc);
+
 // DataChannel, Track, and WebSocket common API
 
 RTC_C_EXPORT int rtcSetOpenCallback(int id, rtcOpenCallbackFunc cb);

+ 7 - 0
src/capi.cpp

@@ -697,6 +697,13 @@ int rtcGetMaxDataChannelStream(int pc) {
 	});
 }
 
+int rtcGetRemoteMaxMessageSize(int pc) {
+	return wrap([&] {
+		auto peerConnection = getPeerConnection(pc);
+		return int(peerConnection->remoteMaxMessageSize());
+	});
+}
+
 int rtcSetOpenCallback(int id, rtcOpenCallbackFunc cb) {
 	return wrap([&] {
 		auto channel = getChannel(id);

+ 2 - 0
src/peerconnection.cpp

@@ -69,6 +69,8 @@ optional<Description> PeerConnection::remoteDescription() const {
 	return impl()->remoteDescription();
 }
 
+size_t PeerConnection::remoteMaxMessageSize() const { return impl()->remoteMaxMessageSize(); }
+
 bool PeerConnection::hasMedia() const {
 	auto local = localDescription();
 	return local && local->hasAudioOrVideo();