diff --git a/include/rtc/rtc.h b/include/rtc/rtc.h index db0754848..6df2ce700 100644 --- a/include/rtc/rtc.h +++ b/include/rtc/rtc.h @@ -157,6 +157,7 @@ typedef void *(RTC_API *rtcInterceptorCallbackFunc)(int pc, const char *message, void *ptr); typedef void(RTC_API *rtcBufferedAmountLowCallbackFunc)(int id, void *ptr); typedef void(RTC_API *rtcAvailableCallbackFunc)(int id, void *ptr); +typedef void(RTC_API *rtcPliHandlerCallbackFunc)(); // Log @@ -369,6 +370,9 @@ RTC_C_EXPORT int rtcChainRtcpSrReporter(int tr); // Chain RtcpNackResponder to handler chain for given track 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 RTC_C_EXPORT int rtcTransformSecondsToTimestamp(int id, double seconds, uint32_t *timestamp); diff --git a/src/capi.cpp b/src/capi.cpp index ffea82c29..d840ff60d 100644 --- a/src/capi.cpp +++ b/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(onPli); + auto chainableHandler = getMediaChainableHandler(tr); + chainableHandler->addToChain(responder); + return RTC_ERR_SUCCESS; + }); +} + int rtcTransformSecondsToTimestamp(int id, double seconds, uint32_t *timestamp) { return wrap([&] { auto config = getRtpConfig(id);