提交 4f520348 authored 作者: Nazar Mokrynskyi's avatar Nazar Mokrynskyi

Refactor request and notification handlers to conform to the same API

上级 3d4ef192
...@@ -51,15 +51,22 @@ namespace Channel ...@@ -51,15 +51,22 @@ namespace Channel
class ChannelSocket : public ConsumerSocket::Listener class ChannelSocket : public ConsumerSocket::Listener
{ {
public: public:
class Listener class RequestHandler
{
public:
virtual ~RequestHandler() = default;
public:
virtual void HandleRequest(Channel::ChannelRequest* request) = 0;
};
class Listener : public RequestHandler
{ {
public: public:
virtual ~Listener() = default; virtual ~Listener() = default;
public: public:
virtual void OnChannelRequest( virtual void OnChannelClosed(Channel::ChannelSocket* channel) = 0;
Channel::ChannelSocket* channel, Channel::ChannelRequest* request) = 0;
virtual void OnChannelClosed(Channel::ChannelSocket* channel) = 0;
}; };
public: public:
......
...@@ -54,18 +54,30 @@ namespace PayloadChannel ...@@ -54,18 +54,30 @@ namespace PayloadChannel
class PayloadChannelSocket : public ConsumerSocket::Listener class PayloadChannelSocket : public ConsumerSocket::Listener
{ {
public: public:
class Listener class RequestHandler
{
public:
virtual ~RequestHandler() = default;
public:
virtual void HandleRequest(PayloadChannel::PayloadChannelRequest* request) = 0;
};
class NotificationHandler
{
public:
virtual ~NotificationHandler() = default;
public:
virtual void HandleNotification(PayloadChannel::Notification* notification) = 0;
};
class Listener : public RequestHandler, public NotificationHandler
{ {
public: public:
virtual ~Listener() = default; virtual ~Listener() = default;
public: public:
virtual void OnPayloadChannelNotification(
PayloadChannel::PayloadChannelSocket* payloadChannel,
PayloadChannel::Notification* notification) = 0;
virtual void OnPayloadChannelRequest(
PayloadChannel::PayloadChannelSocket* payloadChannel,
PayloadChannel::PayloadChannelRequest* request) = 0;
virtual void OnPayloadChannelClosed(PayloadChannel::PayloadChannelSocket* payloadChannel) = 0; virtual void OnPayloadChannelClosed(PayloadChannel::PayloadChannelSocket* payloadChannel) = 0;
}; };
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "common.hpp" #include "common.hpp"
#include "Channel/ChannelRequest.hpp" #include "Channel/ChannelRequest.hpp"
#include "Channel/ChannelSocket.hpp"
#include "RTC/RTCP/CompoundPacket.hpp" #include "RTC/RTCP/CompoundPacket.hpp"
#include "RTC/RTCP/FeedbackPs.hpp" #include "RTC/RTCP/FeedbackPs.hpp"
#include "RTC/RTCP/FeedbackPsFir.hpp" #include "RTC/RTCP/FeedbackPsFir.hpp"
...@@ -23,7 +24,7 @@ using json = nlohmann::json; ...@@ -23,7 +24,7 @@ using json = nlohmann::json;
namespace RTC namespace RTC
{ {
class Consumer class Consumer : Channel::ChannelSocket::RequestHandler
{ {
public: public:
class Listener class Listener
...@@ -70,7 +71,6 @@ namespace RTC ...@@ -70,7 +71,6 @@ namespace RTC
virtual void FillJson(json& jsonObject) const; virtual void FillJson(json& jsonObject) const;
virtual void FillJsonStats(json& jsonArray) const = 0; virtual void FillJsonStats(json& jsonArray) const = 0;
virtual void FillJsonScore(json& jsonObject) const = 0; virtual void FillJsonScore(json& jsonObject) const = 0;
virtual void HandleRequest(Channel::ChannelRequest* request);
RTC::Media::Kind GetKind() const RTC::Media::Kind GetKind() const
{ {
return this->kind; return this->kind;
...@@ -155,6 +155,10 @@ namespace RTC ...@@ -155,6 +155,10 @@ namespace RTC
virtual uint32_t GetTransmissionRate(uint64_t nowMs) = 0; virtual uint32_t GetTransmissionRate(uint64_t nowMs) = 0;
virtual float GetRtt() const = 0; virtual float GetRtt() const = 0;
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
public:
void HandleRequest(Channel::ChannelRequest* request) override;
protected: protected:
void EmitTraceEventRtpAndKeyFrameTypes(RTC::RtpPacket* packet, bool isRtx = false) const; void EmitTraceEventRtpAndKeyFrameTypes(RTC::RtpPacket* packet, bool isRtx = false) const;
void EmitTraceEventKeyFrameType(RTC::RtpPacket* packet, bool isRtx = false) const; void EmitTraceEventKeyFrameType(RTC::RtpPacket* packet, bool isRtx = false) const;
......
...@@ -3,14 +3,17 @@ ...@@ -3,14 +3,17 @@
#include "common.hpp" #include "common.hpp"
#include "Channel/ChannelRequest.hpp" #include "Channel/ChannelRequest.hpp"
#include "Channel/ChannelSocket.hpp"
#include "PayloadChannel/PayloadChannelRequest.hpp" #include "PayloadChannel/PayloadChannelRequest.hpp"
#include "PayloadChannel/PayloadChannelSocket.hpp"
#include "RTC/SctpDictionaries.hpp" #include "RTC/SctpDictionaries.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <string> #include <string>
namespace RTC namespace RTC
{ {
class DataConsumer class DataConsumer : Channel::ChannelSocket::RequestHandler,
PayloadChannel::PayloadChannelSocket::RequestHandler
{ {
protected: protected:
using onQueuedCallback = const std::function<void(bool queued, bool sctpSendBufferFull)>; using onQueuedCallback = const std::function<void(bool queued, bool sctpSendBufferFull)>;
...@@ -50,8 +53,6 @@ namespace RTC ...@@ -50,8 +53,6 @@ namespace RTC
public: public:
void FillJson(json& jsonObject) const; void FillJson(json& jsonObject) const;
void FillJsonStats(json& jsonArray) const; void FillJsonStats(json& jsonArray) const;
void HandleRequest(Channel::ChannelRequest* request);
void HandleRequest(PayloadChannel::PayloadChannelRequest* request);
Type GetType() const Type GetType() const
{ {
return this->type; return this->type;
...@@ -78,6 +79,14 @@ namespace RTC ...@@ -78,6 +79,14 @@ namespace RTC
void DataProducerClosed(); void DataProducerClosed();
void SendMessage(uint32_t ppid, const uint8_t* msg, size_t len, onQueuedCallback* = nullptr); void SendMessage(uint32_t ppid, const uint8_t* msg, size_t len, onQueuedCallback* = nullptr);
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
public:
void HandleRequest(Channel::ChannelRequest* request) override;
/* Methods inherited from PayloadChannel::PayloadChannelSocket::RequestHandler. */
public:
void HandleRequest(PayloadChannel::PayloadChannelRequest* request) override;
public: public:
// Passed by argument. // Passed by argument.
const std::string id; const std::string id;
......
...@@ -3,13 +3,14 @@ ...@@ -3,13 +3,14 @@
#include "common.hpp" #include "common.hpp"
#include "Channel/ChannelRequest.hpp" #include "Channel/ChannelRequest.hpp"
#include "Channel/ChannelSocket.hpp"
#include "RTC/SctpDictionaries.hpp" #include "RTC/SctpDictionaries.hpp"
#include <nlohmann/json.hpp> #include <nlohmann/json.hpp>
#include <string> #include <string>
namespace RTC namespace RTC
{ {
class DataProducer class DataProducer : Channel::ChannelSocket::RequestHandler
{ {
public: public:
class Listener class Listener
...@@ -36,7 +37,6 @@ namespace RTC ...@@ -36,7 +37,6 @@ namespace RTC
public: public:
void FillJson(json& jsonObject) const; void FillJson(json& jsonObject) const;
void FillJsonStats(json& jsonArray) const; void FillJsonStats(json& jsonArray) const;
void HandleRequest(Channel::ChannelRequest* request) const;
Type GetType() const Type GetType() const
{ {
return this->type; return this->type;
...@@ -47,6 +47,10 @@ namespace RTC ...@@ -47,6 +47,10 @@ namespace RTC
} }
void ReceiveMessage(uint32_t ppid, const uint8_t* msg, size_t len); void ReceiveMessage(uint32_t ppid, const uint8_t* msg, size_t len);
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
public:
void HandleRequest(Channel::ChannelRequest* request) override;
public: public:
// Passed by argument. // Passed by argument.
const std::string id; const std::string id;
......
...@@ -14,7 +14,6 @@ namespace RTC ...@@ -14,7 +14,6 @@ namespace RTC
public: public:
void FillJson(json& jsonObject) const override; void FillJson(json& jsonObject) const override;
void FillJsonStats(json& jsonArray) override; void FillJsonStats(json& jsonArray) override;
void HandleRequest(Channel::ChannelRequest* request) override;
void HandleNotification(PayloadChannel::Notification* notification) override; void HandleNotification(PayloadChannel::Notification* notification) override;
private: private:
...@@ -35,6 +34,10 @@ namespace RTC ...@@ -35,6 +34,10 @@ namespace RTC
void RecvStreamClosed(uint32_t ssrc) override; void RecvStreamClosed(uint32_t ssrc) override;
void SendStreamClosed(uint32_t ssrc) override; void SendStreamClosed(uint32_t ssrc) override;
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
public:
void HandleRequest(Channel::ChannelRequest* request) override;
private: private:
// Allocated by this. // Allocated by this.
uint8_t* buffer{ nullptr }; uint8_t* buffer{ nullptr };
......
...@@ -21,7 +21,6 @@ namespace RTC ...@@ -21,7 +21,6 @@ namespace RTC
void FillJson(json& jsonObject) const override; void FillJson(json& jsonObject) const override;
void FillJsonStats(json& jsonArray) const override; void FillJsonStats(json& jsonArray) const override;
void FillJsonScore(json& jsonObject) const override; void FillJsonScore(json& jsonObject) const override;
void HandleRequest(Channel::ChannelRequest* request) override;
void ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override; void ProducerRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
void ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override; void ProducerNewRtpStream(RTC::RtpStream* rtpStream, uint32_t mappedSsrc) override;
void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override; void ProducerRtpStreamScore(RTC::RtpStream* rtpStream, uint8_t score, uint8_t previousScore) override;
...@@ -44,6 +43,10 @@ namespace RTC ...@@ -44,6 +43,10 @@ namespace RTC
uint32_t GetTransmissionRate(uint64_t nowMs) override; uint32_t GetTransmissionRate(uint64_t nowMs) override;
float GetRtt() const override; float GetRtt() const override;
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
public:
void HandleRequest(Channel::ChannelRequest* request) override;
private: private:
void UserOnTransportConnected() override; void UserOnTransportConnected() override;
void UserOnTransportDisconnected() override; void UserOnTransportDisconnected() override;
......
...@@ -29,9 +29,12 @@ namespace RTC ...@@ -29,9 +29,12 @@ namespace RTC
public: public:
void FillJson(json& jsonObject) const override; void FillJson(json& jsonObject) const override;
void FillJsonStats(json& jsonArray) override; void FillJsonStats(json& jsonArray) override;
void HandleRequest(Channel::ChannelRequest* request) override;
void HandleNotification(PayloadChannel::Notification* notification) override; void HandleNotification(PayloadChannel::Notification* notification) override;
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
public:
void HandleRequest(Channel::ChannelRequest* request) override;
private: private:
bool IsConnected() const override; bool IsConnected() const override;
bool HasSrtp() const; bool HasSrtp() const;
......
...@@ -29,9 +29,12 @@ namespace RTC ...@@ -29,9 +29,12 @@ namespace RTC
public: public:
void FillJson(json& jsonObject) const override; void FillJson(json& jsonObject) const override;
void FillJsonStats(json& jsonArray) override; void FillJsonStats(json& jsonArray) override;
void HandleRequest(Channel::ChannelRequest* request) override;
void HandleNotification(PayloadChannel::Notification* notification) override; void HandleNotification(PayloadChannel::Notification* notification) override;
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
public:
void HandleRequest(Channel::ChannelRequest* request) override;
private: private:
bool IsConnected() const override; bool IsConnected() const override;
bool HasSrtp() const; bool HasSrtp() const;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
#include "common.hpp" #include "common.hpp"
#include "Channel/ChannelRequest.hpp" #include "Channel/ChannelRequest.hpp"
#include "Channel/ChannelSocket.hpp"
#include "RTC/KeyFrameRequestManager.hpp" #include "RTC/KeyFrameRequestManager.hpp"
#include "RTC/RTCP/CompoundPacket.hpp" #include "RTC/RTCP/CompoundPacket.hpp"
#include "RTC/RTCP/Packet.hpp" #include "RTC/RTCP/Packet.hpp"
...@@ -20,7 +21,9 @@ using json = nlohmann::json; ...@@ -20,7 +21,9 @@ using json = nlohmann::json;
namespace RTC namespace RTC
{ {
class Producer : public RTC::RtpStreamRecv::Listener, public RTC::KeyFrameRequestManager::Listener class Producer : public RTC::RtpStreamRecv::Listener,
public RTC::KeyFrameRequestManager::Listener,
Channel::ChannelSocket::RequestHandler
{ {
public: public:
class Listener class Listener
...@@ -91,7 +94,6 @@ namespace RTC ...@@ -91,7 +94,6 @@ namespace RTC
public: public:
void FillJson(json& jsonObject) const; void FillJson(json& jsonObject) const;
void FillJsonStats(json& jsonArray) const; void FillJsonStats(json& jsonArray) const;
void HandleRequest(Channel::ChannelRequest* request);
RTC::Media::Kind GetKind() const RTC::Media::Kind GetKind() const
{ {
return this->kind; return this->kind;
...@@ -126,6 +128,10 @@ namespace RTC ...@@ -126,6 +128,10 @@ namespace RTC
void GetRtcp(RTC::RTCP::CompoundPacket* packet, uint64_t nowMs); void GetRtcp(RTC::RTCP::CompoundPacket* packet, uint64_t nowMs);
void RequestKeyFrame(uint32_t mappedSsrc); void RequestKeyFrame(uint32_t mappedSsrc);
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
public:
void HandleRequest(Channel::ChannelRequest* request) override;
private: private:
RTC::RtpStreamRecv* GetRtpStream(RTC::RtpPacket* packet); RTC::RtpStreamRecv* GetRtpStream(RTC::RtpPacket* packet);
RTC::RtpStreamRecv* CreateRtpStream( RTC::RtpStreamRecv* CreateRtpStream(
......
...@@ -23,7 +23,10 @@ using json = nlohmann::json; ...@@ -23,7 +23,10 @@ using json = nlohmann::json;
namespace RTC namespace RTC
{ {
class Router : public RTC::Transport::Listener class Router : public RTC::Transport::Listener,
Channel::ChannelSocket::RequestHandler,
PayloadChannel::PayloadChannelSocket::RequestHandler,
PayloadChannel::PayloadChannelSocket::NotificationHandler
{ {
public: public:
class Listener class Listener
...@@ -42,9 +45,18 @@ namespace RTC ...@@ -42,9 +45,18 @@ namespace RTC
public: public:
void FillJson(json& jsonObject) const; void FillJson(json& jsonObject) const;
void HandleRequest(Channel::ChannelRequest* request);
void HandleRequest(PayloadChannel::PayloadChannelRequest* request); /* Methods inherited from Channel::ChannelSocket::RequestHandler. */
void HandleNotification(PayloadChannel::Notification* notification); public:
void HandleRequest(Channel::ChannelRequest* request) override;
/* Methods inherited from PayloadChannel::PayloadChannelSocket::RequestHandler. */
public:
void HandleRequest(PayloadChannel::PayloadChannelRequest* request) override;
/* Methods inherited from PayloadChannel::PayloadChannelSocket::NotificationHandler. */
public:
void HandleNotification(PayloadChannel::Notification* notification) override;
private: private:
void SetNewTransportIdFromInternal(json& internal, std::string& transportId) const; void SetNewTransportIdFromInternal(json& internal, std::string& transportId) const;
......
...@@ -21,7 +21,6 @@ namespace RTC ...@@ -21,7 +21,6 @@ namespace RTC
void FillJson(json& jsonObject) const override; void FillJson(json& jsonObject) const override;
void FillJsonStats(json& jsonArray) const override; void FillJsonStats(json& jsonArray) const override;
void FillJsonScore(json& jsonObject) const override; void FillJsonScore(json& jsonObject) const override;
void HandleRequest(Channel::ChannelRequest* request) override;
bool IsActive() const override bool IsActive() const override
{ {
// clang-format off // clang-format off
...@@ -54,6 +53,10 @@ namespace RTC ...@@ -54,6 +53,10 @@ namespace RTC
uint32_t GetTransmissionRate(uint64_t nowMs) override; uint32_t GetTransmissionRate(uint64_t nowMs) override;
float GetRtt() const override; float GetRtt() const override;
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
public:
void HandleRequest(Channel::ChannelRequest* request) override;
private: private:
void UserOnTransportConnected() override; void UserOnTransportConnected() override;
void UserOnTransportDisconnected() override; void UserOnTransportDisconnected() override;
......
...@@ -22,7 +22,6 @@ namespace RTC ...@@ -22,7 +22,6 @@ namespace RTC
void FillJson(json& jsonObject) const override; void FillJson(json& jsonObject) const override;
void FillJsonStats(json& jsonArray) const override; void FillJsonStats(json& jsonArray) const override;
void FillJsonScore(json& jsonObject) const override; void FillJsonScore(json& jsonObject) const override;
void HandleRequest(Channel::ChannelRequest* request) override;
RTC::Consumer::Layers GetPreferredLayers() const override RTC::Consumer::Layers GetPreferredLayers() const override
{ {
RTC::Consumer::Layers layers; RTC::Consumer::Layers layers;
...@@ -70,6 +69,10 @@ namespace RTC ...@@ -70,6 +69,10 @@ namespace RTC
uint32_t GetTransmissionRate(uint64_t nowMs) override; uint32_t GetTransmissionRate(uint64_t nowMs) override;
float GetRtt() const override; float GetRtt() const override;
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
public:
void HandleRequest(Channel::ChannelRequest* request) override;
private: private:
void UserOnTransportConnected() override; void UserOnTransportConnected() override;
void UserOnTransportDisconnected() override; void UserOnTransportDisconnected() override;
......
...@@ -23,7 +23,6 @@ namespace RTC ...@@ -23,7 +23,6 @@ namespace RTC
void FillJson(json& jsonObject) const override; void FillJson(json& jsonObject) const override;
void FillJsonStats(json& jsonArray) const override; void FillJsonStats(json& jsonArray) const override;
void FillJsonScore(json& jsonObject) const override; void FillJsonScore(json& jsonObject) const override;
void HandleRequest(Channel::ChannelRequest* request) override;
RTC::Consumer::Layers GetPreferredLayers() const override RTC::Consumer::Layers GetPreferredLayers() const override
{ {
RTC::Consumer::Layers layers; RTC::Consumer::Layers layers;
...@@ -65,6 +64,10 @@ namespace RTC ...@@ -65,6 +64,10 @@ namespace RTC
uint32_t GetTransmissionRate(uint64_t nowMs) override; uint32_t GetTransmissionRate(uint64_t nowMs) override;
float GetRtt() const override; float GetRtt() const override;
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
public:
void HandleRequest(Channel::ChannelRequest* request) override;
private: private:
void UserOnTransportConnected() override; void UserOnTransportConnected() override;
void UserOnTransportDisconnected() override; void UserOnTransportDisconnected() override;
......
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
#include "common.hpp" #include "common.hpp"
#include "DepLibUV.hpp" #include "DepLibUV.hpp"
#include "Channel/ChannelRequest.hpp" #include "Channel/ChannelRequest.hpp"
#include "Channel/ChannelSocket.hpp"
#include "PayloadChannel/Notification.hpp" #include "PayloadChannel/Notification.hpp"
#include "PayloadChannel/PayloadChannelRequest.hpp" #include "PayloadChannel/PayloadChannelRequest.hpp"
#include "RTC/Consumer.hpp" #include "RTC/Consumer.hpp"
......
...@@ -20,7 +20,8 @@ namespace RTC ...@@ -20,7 +20,8 @@ namespace RTC
class WebRtcServer : public RTC::UdpSocket::Listener, class WebRtcServer : public RTC::UdpSocket::Listener,
public RTC::TcpServer::Listener, public RTC::TcpServer::Listener,
public RTC::TcpConnection::Listener, public RTC::TcpConnection::Listener,
public RTC::WebRtcTransport::WebRtcTransportListener public RTC::WebRtcTransport::WebRtcTransportListener,
Channel::ChannelSocket::RequestHandler
{ {
private: private:
struct ListenInfo struct ListenInfo
...@@ -51,10 +52,13 @@ namespace RTC ...@@ -51,10 +52,13 @@ namespace RTC
public: public:
void FillJson(json& jsonObject) const; void FillJson(json& jsonObject) const;
void HandleRequest(Channel::ChannelRequest* request);
std::vector<RTC::IceCandidate> GetIceCandidates( std::vector<RTC::IceCandidate> GetIceCandidates(
bool enableUdp, bool enableTcp, bool preferUdp, bool preferTcp); bool enableUdp, bool enableTcp, bool preferUdp, bool preferTcp);
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
public:
void HandleRequest(Channel::ChannelRequest* request) override;
private: private:
std::string GetLocalIceUsernameFragmentFromReceivedStunPacket(RTC::StunPacket* packet) const; std::string GetLocalIceUsernameFragmentFromReceivedStunPacket(RTC::StunPacket* packet) const;
void OnPacketReceived(RTC::TransportTuple* tuple, const uint8_t* data, size_t len); void OnPacketReceived(RTC::TransportTuple* tuple, const uint8_t* data, size_t len);
......
...@@ -61,13 +61,16 @@ namespace RTC ...@@ -61,13 +61,16 @@ namespace RTC
public: public:
void FillJson(json& jsonObject) const override; void FillJson(json& jsonObject) const override;
void FillJsonStats(json& jsonArray) override; void FillJsonStats(json& jsonArray) override;
void HandleRequest(Channel::ChannelRequest* request) override;
void HandleNotification(PayloadChannel::Notification* notification) override; void HandleNotification(PayloadChannel::Notification* notification) override;
void ProcessStunPacketFromWebRtcServer(RTC::TransportTuple* tuple, RTC::StunPacket* packet); void ProcessStunPacketFromWebRtcServer(RTC::TransportTuple* tuple, RTC::StunPacket* packet);
void ProcessNonStunPacketFromWebRtcServer( void ProcessNonStunPacketFromWebRtcServer(
RTC::TransportTuple* tuple, const uint8_t* data, size_t len); RTC::TransportTuple* tuple, const uint8_t* data, size_t len);
void RemoveTuple(RTC::TransportTuple* tuple); void RemoveTuple(RTC::TransportTuple* tuple);
/* Methods inherited from Channel::ChannelSocket::RequestHandler. */
public:
void HandleRequest(Channel::ChannelRequest* request) override;
private: private:
bool IsConnected() const override; bool IsConnected() const override;
void MayRunDtlsTransport(); void MayRunDtlsTransport();
......
...@@ -34,19 +34,24 @@ private: ...@@ -34,19 +34,24 @@ private:
void SetNewRouterIdFromInternal(json& internal, std::string& routerId) const; void SetNewRouterIdFromInternal(json& internal, std::string& routerId) const;
RTC::Router* GetRouterFromInternal(json& internal) const; RTC::Router* GetRouterFromInternal(json& internal) const;
/* Methods inherited from Channel::lUnixStreamSocket::Listener. */ /* Methods inherited from Channel::ChannelSocket::RequestHandler. */
public:
void HandleRequest(Channel::ChannelRequest* request) override;
/* Methods inherited from Channel::ChannelSocket::Listener. */
public: public:
void OnChannelRequest(Channel::ChannelSocket* channel, Channel::ChannelRequest* request) override;
void OnChannelClosed(Channel::ChannelSocket* channel) override; void OnChannelClosed(Channel::ChannelSocket* channel) override;
/* Methods inherited from PayloadChannel::lUnixStreamSocket::Listener. */ /* Methods inherited from PayloadChannel::PayloadChannelSocket::RequestHandler. */
public:
void HandleRequest(PayloadChannel::PayloadChannelRequest* request) override;
/* Methods inherited from PayloadChannel::PayloadChannelSocket::NotificationHandler. */
public:
void HandleNotification(PayloadChannel::Notification* notification) override;
/* Methods inherited from PayloadChannel::PayloadChannelSocket::Listener. */
public: public:
void OnPayloadChannelNotification(
PayloadChannel::PayloadChannelSocket* payloadChannel,
PayloadChannel::Notification* notification) override;
void OnPayloadChannelRequest(
PayloadChannel::PayloadChannelSocket* payloadChannel,
PayloadChannel::PayloadChannelRequest* request) override;
void OnPayloadChannelClosed(PayloadChannel::PayloadChannelSocket* payloadChannel) override; void OnPayloadChannelClosed(PayloadChannel::PayloadChannelSocket* payloadChannel) override;
/* Methods inherited from SignalsHandler::Listener. */ /* Methods inherited from SignalsHandler::Listener. */
......
...@@ -181,7 +181,7 @@ namespace Channel ...@@ -181,7 +181,7 @@ namespace Channel
// Notify the listener. // Notify the listener.
try try
{ {
this->listener->OnChannelRequest(this, request); this->listener->HandleRequest(request);
} }
catch (const MediaSoupTypeError& error) catch (const MediaSoupTypeError& error)
{ {
...@@ -246,7 +246,7 @@ namespace Channel ...@@ -246,7 +246,7 @@ namespace Channel
// Notify the listener. // Notify the listener.
try try
{ {
this->listener->OnChannelRequest(this, request); this->listener->HandleRequest(request);
} }
catch (const MediaSoupTypeError& error) catch (const MediaSoupTypeError& error)
{ {
......
...@@ -212,7 +212,7 @@ namespace PayloadChannel ...@@ -212,7 +212,7 @@ namespace PayloadChannel
// Notify the listener. // Notify the listener.
try try
{ {
this->listener->OnPayloadChannelRequest(this, request); this->listener->HandleRequest(request);
} }
catch (const MediaSoupTypeError& error) catch (const MediaSoupTypeError& error)
{ {
...@@ -246,7 +246,7 @@ namespace PayloadChannel ...@@ -246,7 +246,7 @@ namespace PayloadChannel
// Notify the listener. // Notify the listener.
try try
{ {
this->listener->OnPayloadChannelNotification(this, notification); this->listener->HandleNotification(notification);
} }
catch (const MediaSoupError& error) catch (const MediaSoupError& error)
{ {
...@@ -381,7 +381,7 @@ namespace PayloadChannel ...@@ -381,7 +381,7 @@ namespace PayloadChannel
// Notify the listener. // Notify the listener.
try try
{ {
this->listener->OnPayloadChannelNotification(this, this->ongoingNotification); this->listener->HandleNotification(this->ongoingNotification);
} }
catch (const MediaSoupError& error) catch (const MediaSoupError& error)
{ {
...@@ -399,7 +399,7 @@ namespace PayloadChannel ...@@ -399,7 +399,7 @@ namespace PayloadChannel
// Notify the listener. // Notify the listener.
try try
{ {
this->listener->OnPayloadChannelRequest(this, this->ongoingRequest); this->listener->HandleRequest(this->ongoingRequest);
} }
catch (const MediaSoupTypeError& error) catch (const MediaSoupTypeError& error)
{ {
......
...@@ -110,7 +110,7 @@ namespace RTC ...@@ -110,7 +110,7 @@ namespace RTC
jsonObject["bytesReceived"] = this->bytesReceived; jsonObject["bytesReceived"] = this->bytesReceived;
} }
void DataProducer::HandleRequest(Channel::ChannelRequest* request) const void DataProducer::HandleRequest(Channel::ChannelRequest* request)
{ {
MS_TRACE(); MS_TRACE();
......
...@@ -253,7 +253,7 @@ RTC::Router* Worker::GetRouterFromInternal(json& internal) const ...@@ -253,7 +253,7 @@ RTC::Router* Worker::GetRouterFromInternal(json& internal) const
return router; return router;
} }
inline void Worker::OnChannelRequest(Channel::ChannelSocket* /*channel*/, Channel::ChannelRequest* request) inline void Worker::HandleRequest(Channel::ChannelRequest* request)
{ {
MS_TRACE(); MS_TRACE();
...@@ -458,8 +458,7 @@ inline void Worker::OnChannelClosed(Channel::ChannelSocket* /*socket*/) ...@@ -458,8 +458,7 @@ inline void Worker::OnChannelClosed(Channel::ChannelSocket* /*socket*/)
Close(); Close();
} }
inline void Worker::OnPayloadChannelNotification( inline void Worker::HandleNotification(PayloadChannel::Notification* notification)
PayloadChannel::PayloadChannelSocket* /*payloadChannel*/, PayloadChannel::Notification* notification)
{ {
MS_TRACE(); MS_TRACE();
...@@ -481,9 +480,7 @@ inline void Worker::OnPayloadChannelNotification( ...@@ -481,9 +480,7 @@ inline void Worker::OnPayloadChannelNotification(
} }
} }
inline void Worker::OnPayloadChannelRequest( inline void Worker::HandleRequest(PayloadChannel::PayloadChannelRequest* request)
PayloadChannel::PayloadChannelSocket* /*payloadChannel*/,
PayloadChannel::PayloadChannelRequest* request)
{ {
MS_TRACE(); MS_TRACE();
......
Markdown 格式
0% 或
您添加了 0 人 到此讨论。请谨慎行事。
请先完成此评论的编辑!
请 注册 或者 后发表评论