Browse Source

Expose channel max message size in C API

Paul-Louis Ageneau 1 year ago
parent
commit
b144cfbc27
2 changed files with 8 additions and 1 deletions
  1. 1 1
      include/rtc/rtc.h
  2. 7 0
      src/capi.cpp

+ 1 - 1
include/rtc/rtc.h

@@ -213,7 +213,6 @@ RTC_C_EXPORT int rtcGetSelectedCandidatePair(int pc, char *local, int localSize,
                                              int remoteSize);
 
 RTC_C_EXPORT int rtcGetMaxDataChannelStream(int pc);
-
 RTC_C_EXPORT int rtcGetRemoteMaxMessageSize(int pc);
 
 // DataChannel, Track, and WebSocket common API
@@ -228,6 +227,7 @@ RTC_C_EXPORT int rtcDelete(int id);
 RTC_C_EXPORT bool rtcIsOpen(int id);
 RTC_C_EXPORT bool rtcIsClosed(int id);
 
+RTC_C_EXPORT int rtcMaxMessageSize(int id);
 RTC_C_EXPORT int rtcGetBufferedAmount(int id); // total size buffered to send
 RTC_C_EXPORT int rtcSetBufferedAmountLowThreshold(int id, int amount);
 RTC_C_EXPORT int rtcSetBufferedAmountLowCallback(int id, rtcBufferedAmountLowCallbackFunc cb);

+ 7 - 0
src/capi.cpp

@@ -807,6 +807,13 @@ bool rtcIsClosed(int id) {
 	return wrap([id] { return getChannel(id)->isClosed() ? 0 : 1; }) == 0 ? true : false;
 }
 
+int rtcMaxMessageSize(int id) {
+	return wrap([id] {
+		auto channel = getChannel(id);
+		return int(channel->maxMessageSize());
+	});
+}
+
 int rtcGetBufferedAmount(int id) {
 	return wrap([id] {
 		auto channel = getChannel(id);