Skip to content

Commit

Permalink
Rename PliHandler::onPli to mOnPli and convert it to a synchronized
Browse files Browse the repository at this point in the history
callback
  • Loading branch information
kuzux committed Oct 23, 2023
1 parent 4d228e8 commit 56cab34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
5 changes: 3 additions & 2 deletions include/rtc/plihandler.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -12,19 +12,20 @@
#if RTC_ENABLE_MEDIA

#include "mediahandlerelement.hpp"
#include "utils.hpp"
#include <functional>

namespace rtc {

/// Responds to PLI and FIR messages sent by the receiver. The sender should respond to these
/// messages by sending an intra.
class RTC_CPP_EXPORT PliHandler final : public MediaHandlerElement {
std::function<void(void)> onPli;
std::function<void(void)> mOnPli;

public:
/// Constructs the PLIResponder object to notify whenever a new intra frame is requested
/// @param onPli The callback that gets called whenever an intra frame is requested by the receiver
PliHandler(std::function<void(void)> onPli);
PliHandler(rtc::synchronized_callback<> onPli);
ChainedIncomingControlProduct processIncomingControlMessage(message_ptr) override;
};

Expand Down
6 changes: 3 additions & 3 deletions src/plihandler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ ChainedIncomingControlProduct PliHandler::processIncomingControlMessage(message_

if (payload_type == 196) {
// FIR message, call pli handler anyway
onPli();
mOnPli();
break;
} else if (payload_type == 206) {
// On a payload specific fb message, there is a "feedback message type" (FMT) in the
// header instead of a report count. PT = 206, FMT = 1 means a PLI message
uint8_t feedback_message_type = header->reportCount();
if (feedback_message_type == 1) {
onPli();
mOnPli();
break;
}
}
Expand All @@ -37,7 +37,7 @@ ChainedIncomingControlProduct PliHandler::processIncomingControlMessage(message_
return { message, std::nullopt };
}

PliHandler::PliHandler(std::function<void(void)> onPli) : onPli(onPli) { }
PliHandler::PliHandler(rtc::synchronized_callback<> onPli) : mOnPli(onPli) { }

}

Expand Down

0 comments on commit 56cab34

Please sign in to comment.