From a6b1b5cb5541d1d7e8f09a4ff3b7224dd6f57306 Mon Sep 17 00:00:00 2001 From: Shuhei Tanuma Date: Sat, 4 Nov 2023 11:22:47 +0900 Subject: [PATCH 1/2] [CAPI] add RtcpReceivingSession support --- include/rtc/rtc.h | 6 ++++++ src/capi.cpp | 25 +++++++++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/include/rtc/rtc.h b/include/rtc/rtc.h index 55b26d3fa..e5e77b590 100644 --- a/include/rtc/rtc.h +++ b/include/rtc/rtc.h @@ -291,6 +291,9 @@ RTC_C_EXPORT int rtcGetTrackDescription(int tr, char *buffer, int size); RTC_C_EXPORT int rtcGetTrackMid(int tr, char *buffer, int size); RTC_C_EXPORT int rtcGetTrackDirection(int tr, rtcDirection *direction); +RTC_C_EXPORT int rtcSendTrackRequestKeyframe(int tr); +RTC_C_EXPORT int rtcSendTrackRequestBitrate(int tr, unsigned int bitrate); + #if RTC_ENABLE_MEDIA // Media @@ -364,6 +367,9 @@ RTC_C_EXPORT int rtcSetOpusPacketizationHandler(int tr, const rtcPacketizationHa // Set AACPacketizationHandler for track RTC_C_EXPORT int rtcSetAACPacketizationHandler(int tr, const rtcPacketizationHandlerInit *init); +// Set RtcpReceivingSession for track +RTC_C_EXPORT int rtcSetRtcpReceivingSession(int tr); + // Chain RtcpSrReporter to handler chain for given track RTC_C_EXPORT int rtcChainRtcpSrReporter(int tr); diff --git a/src/capi.cpp b/src/capi.cpp index ce0cb77f6..5aba61b4c 100644 --- a/src/capi.cpp +++ b/src/capi.cpp @@ -1144,6 +1144,22 @@ int rtcGetTrackDirection(int tr, rtcDirection *direction) { }); } +int rtcSendTrackRequestKeyframe(int tr) { + return wrap([&] { + auto track = getTrack(tr); + track->requestKeyframe(); + return RTC_ERR_SUCCESS; + }); +} + +int rtcSendTrackRequestBitrate(int tr, unsigned int bitrate) { + return wrap([&] { + auto track = getTrack(tr); + track->requestBitrate(bitrate); + return RTC_ERR_SUCCESS; + }); +} + #if RTC_ENABLE_MEDIA void setSSRC(Description::Media *description, uint32_t ssrc, const char *_name, const char *_msid, @@ -1276,6 +1292,15 @@ int rtcSetAACPacketizationHandler(int tr, const rtcPacketizationHandlerInit *ini }); } +int rtcSetRtcpReceivingSession(int tr) { + return wrap([&] { + auto track = getTrack(tr); + auto session = std::make_shared(); + track->setMediaHandler(session); + return RTC_ERR_SUCCESS; + }); +} + int rtcChainRtcpSrReporter(int tr) { return wrap([&] { auto track = getTrack(tr); From 11826d2c6bfd0f5b3f45f543adc0ae0d0c68ba03 Mon Sep 17 00:00:00 2001 From: Paul-Louis Ageneau Date: Sat, 20 Jan 2024 17:34:48 +0100 Subject: [PATCH 2/2] Rename C API functions for RtcpReceivingSession --- include/rtc/rtc.h | 6 +++--- src/capi.cpp | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/include/rtc/rtc.h b/include/rtc/rtc.h index e5e77b590..464d9ceb1 100644 --- a/include/rtc/rtc.h +++ b/include/rtc/rtc.h @@ -291,8 +291,8 @@ RTC_C_EXPORT int rtcGetTrackDescription(int tr, char *buffer, int size); RTC_C_EXPORT int rtcGetTrackMid(int tr, char *buffer, int size); RTC_C_EXPORT int rtcGetTrackDirection(int tr, rtcDirection *direction); -RTC_C_EXPORT int rtcSendTrackRequestKeyframe(int tr); -RTC_C_EXPORT int rtcSendTrackRequestBitrate(int tr, unsigned int bitrate); +RTC_C_EXPORT int rtcRequestKeyframe(int tr); +RTC_C_EXPORT int rtcRequestBitrate(int tr, unsigned int bitrate); #if RTC_ENABLE_MEDIA @@ -368,7 +368,7 @@ RTC_C_EXPORT int rtcSetOpusPacketizationHandler(int tr, const rtcPacketizationHa RTC_C_EXPORT int rtcSetAACPacketizationHandler(int tr, const rtcPacketizationHandlerInit *init); // Set RtcpReceivingSession for track -RTC_C_EXPORT int rtcSetRtcpReceivingSession(int tr); +RTC_C_EXPORT int rtcChainRtcpReceivingSession(int tr); // Chain RtcpSrReporter to handler chain for given track RTC_C_EXPORT int rtcChainRtcpSrReporter(int tr); diff --git a/src/capi.cpp b/src/capi.cpp index 5aba61b4c..54a5b4edb 100644 --- a/src/capi.cpp +++ b/src/capi.cpp @@ -1144,7 +1144,7 @@ int rtcGetTrackDirection(int tr, rtcDirection *direction) { }); } -int rtcSendTrackRequestKeyframe(int tr) { +int rtcRequestKeyframe(int tr) { return wrap([&] { auto track = getTrack(tr); track->requestKeyframe(); @@ -1152,7 +1152,7 @@ int rtcSendTrackRequestKeyframe(int tr) { }); } -int rtcSendTrackRequestBitrate(int tr, unsigned int bitrate) { +int rtcRequestBitrate(int tr, unsigned int bitrate) { return wrap([&] { auto track = getTrack(tr); track->requestBitrate(bitrate); @@ -1292,11 +1292,11 @@ int rtcSetAACPacketizationHandler(int tr, const rtcPacketizationHandlerInit *ini }); } -int rtcSetRtcpReceivingSession(int tr) { +int rtcChainRtcpReceivingSession(int tr) { return wrap([&] { auto track = getTrack(tr); auto session = std::make_shared(); - track->setMediaHandler(session); + track->chainMediaHandler(session); return RTC_ERR_SUCCESS; }); }