#define MS_CLASS "RTC::IceCandidate"
#include "RTC/IceCandidate.hpp"
#include "Logger.hpp"
namespace RTC
{
IceCandidate::CandidateType IceCandidate::CandidateTypeFromFbs(
FBS::WebRtcTransport::IceCandidateType type)
{
switch (type)
{
case FBS::WebRtcTransport::IceCandidateType::HOST:
{
return IceCandidate::CandidateType::HOST;
}
NO_DEFAULT_GCC();
}
}
FBS::WebRtcTransport::IceCandidateType IceCandidate::CandidateTypeToFbs(IceCandidate::CandidateType type)
{
switch (type)
{
case IceCandidate::CandidateType::HOST:
{
return FBS::WebRtcTransport::IceCandidateType::HOST;
}
NO_DEFAULT_GCC();
}
}
IceCandidate::TcpCandidateType IceCandidate::TcpCandidateTypeFromFbs(
FBS::WebRtcTransport::IceCandidateTcpType type)
{
switch (type)
{
case FBS::WebRtcTransport::IceCandidateTcpType::PASSIVE:
{
return IceCandidate::TcpCandidateType::PASSIVE;
}
NO_DEFAULT_GCC();
}
}
FBS::WebRtcTransport::IceCandidateTcpType IceCandidate::TcpCandidateTypeToFbs(
IceCandidate::TcpCandidateType type)
{
switch (type)
{
case IceCandidate::TcpCandidateType::PASSIVE:
{
return FBS::WebRtcTransport::IceCandidateTcpType::PASSIVE;
}
NO_DEFAULT_GCC();
}
}
flatbuffers::Offset<FBS::WebRtcTransport::IceCandidate> IceCandidate::FillBuffer(
flatbuffers::FlatBufferBuilder& builder) const
{
MS_TRACE();
auto protocol = TransportTuple::ProtocolToFbs(this->protocol);
auto type = CandidateTypeToFbs(this->type);
flatbuffers::Optional<FBS::WebRtcTransport::IceCandidateTcpType> tcpType;
if (this->protocol == Protocol::TCP)
{
tcpType.emplace(TcpCandidateTypeToFbs(this->tcpType));
}
return FBS::WebRtcTransport::CreateIceCandidateDirect(
builder,
this->foundation.c_str(),
this->priority,
this->address.c_str(),
protocol,
this->port,
type,
tcpType);
}
}