mirror of
https://github.com/mii443/libdatachannel.git
synced 2025-12-04 11:38:31 +00:00
refactored to use getRtcpHandler()
This commit is contained in:
@@ -62,11 +62,8 @@ bool Track::send(message_variant data) {
|
|||||||
|
|
||||||
auto message = make_message(std::move(data));
|
auto message = make_message(std::move(data));
|
||||||
|
|
||||||
std::shared_lock lock(mRtcpHandlerMutex);
|
if (auto handler = getRtcpHandler()) {
|
||||||
if (mRtcpHandler) {
|
message = handler->outgoing(message);
|
||||||
auto copy = mRtcpHandler;
|
|
||||||
lock.unlock();
|
|
||||||
message = copy->outgoing(message);
|
|
||||||
if (!message)
|
if (!message)
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@@ -125,11 +122,8 @@ void Track::incoming(message_ptr message) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::shared_lock lock(mRtcpHandlerMutex);
|
if (auto handler = getRtcpHandler()) {
|
||||||
if (mRtcpHandler) {
|
message = handler->incoming(message);
|
||||||
auto copy = mRtcpHandler;
|
|
||||||
lock.unlock();
|
|
||||||
message = copy->incoming(message);
|
|
||||||
if (!message)
|
if (!message)
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -175,11 +169,8 @@ void Track::setRtcpHandler(std::shared_ptr<RtcpHandler> handler) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool Track::requestKeyframe() {
|
bool Track::requestKeyframe() {
|
||||||
std::shared_lock lock(mRtcpHandlerMutex);
|
if (auto handler = getRtcpHandler()) {
|
||||||
if (mRtcpHandler) {
|
return handler->requestKeyframe();
|
||||||
auto copy = mRtcpHandler;
|
|
||||||
lock.unlock();
|
|
||||||
return copy->requestKeyframe();
|
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user