소스 검색

Add Pli handler to C API

Shuhei Tanuma 1 년 전
부모
커밋
ebc80b5f01
2개의 변경된 파일13개의 추가작업 그리고 0개의 파일을 삭제
  1. 4 0
      include/rtc/rtc.h
  2. 9 0
      src/capi.cpp

+ 4 - 0
include/rtc/rtc.h

@@ -157,6 +157,7 @@ typedef void *(RTC_API *rtcInterceptorCallbackFunc)(int pc, const char *message,
                                                     void *ptr);
                                                     void *ptr);
 typedef void(RTC_API *rtcBufferedAmountLowCallbackFunc)(int id, void *ptr);
 typedef void(RTC_API *rtcBufferedAmountLowCallbackFunc)(int id, void *ptr);
 typedef void(RTC_API *rtcAvailableCallbackFunc)(int id, void *ptr);
 typedef void(RTC_API *rtcAvailableCallbackFunc)(int id, void *ptr);
+typedef void(RTC_API *rtcPliHandlerCallbackFunc)();
 
 
 // Log
 // Log
 
 
@@ -369,6 +370,9 @@ RTC_C_EXPORT int rtcChainRtcpSrReporter(int tr);
 // Chain RtcpNackResponder to handler chain for given track
 // Chain RtcpNackResponder to handler chain for given track
 RTC_C_EXPORT int rtcChainRtcpNackResponder(int tr, unsigned int maxStoredPacketsCount);
 RTC_C_EXPORT int rtcChainRtcpNackResponder(int tr, unsigned int maxStoredPacketsCount);
 
 
+// Chain PliHandler to handler chain for given track
+RTC_C_EXPORT int rtcChainPliHandler(int tr, rtcPliHandlerCallbackFunc onPli);
+
 // Transform seconds to timestamp using track's clock rate, result is written to timestamp
 // Transform seconds to timestamp using track's clock rate, result is written to timestamp
 RTC_C_EXPORT int rtcTransformSecondsToTimestamp(int id, double seconds, uint32_t *timestamp);
 RTC_C_EXPORT int rtcTransformSecondsToTimestamp(int id, double seconds, uint32_t *timestamp);
 
 

+ 9 - 0
src/capi.cpp

@@ -1338,6 +1338,15 @@ int rtcChainRtcpNackResponder(int tr, unsigned int maxStoredPacketsCount) {
 	});
 	});
 }
 }
 
 
+int rtcChainPliHandler(int tr, rtcPliHandlerCallbackFunc onPli) {
+	return wrap([tr, onPli] {
+		auto responder = std::make_shared<PliHandler>(onPli);
+		auto chainableHandler = getMediaChainableHandler(tr);
+		chainableHandler->addToChain(responder);
+		return RTC_ERR_SUCCESS;
+	});
+}
+
 int rtcTransformSecondsToTimestamp(int id, double seconds, uint32_t *timestamp) {
 int rtcTransformSecondsToTimestamp(int id, double seconds, uint32_t *timestamp) {
 	return wrap([&] {
 	return wrap([&] {
 		auto config = getRtpConfig(id);
 		auto config = getRtpConfig(id);