Skip to content

Commit

Permalink
Merge pull request #1019 from chobie/capi_pli_handler
Browse files Browse the repository at this point in the history
Add Pli handler to C API
  • Loading branch information
paullouisageneau authored Oct 29, 2023
2 parents d2d17b2 + ebc80b5 commit 86bbda0
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 0 deletions.
4 changes: 4 additions & 0 deletions include/rtc/rtc.h
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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);

Expand Down
9 changes: 9 additions & 0 deletions src/capi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
return wrap([&] {
auto config = getRtpConfig(id);
Expand Down

0 comments on commit 86bbda0

Please sign in to comment.