#define MS_CLASS "RTC::RtcpFeedback"
#include "Logger.hpp"
#include "MediaSoupErrors.hpp"
#include "RTC/RtpDictionaries.hpp"
namespace RTC
{
RtcpFeedback::RtcpFeedback(json& data)
{
MS_TRACE();
if (!data.is_object())
MS_THROW_TYPE_ERROR("data is not an object");
auto jsonTypeIt = data.find("type");
auto jsonParameterIt = data.find("parameter");
if (jsonTypeIt == data.end() || !jsonTypeIt->is_string())
MS_THROW_TYPE_ERROR("missing type");
this->type = jsonTypeIt->get<std::string>();
if (jsonParameterIt != data.end() && jsonParameterIt->is_string())
this->parameter = jsonParameterIt->get<std::string>();
}
void RtcpFeedback::FillJson(json& jsonObject) const
{
MS_TRACE();
jsonObject["type"] = this->type;
if (this->parameter.length() > 0)
jsonObject["parameter"] = this->parameter;
}
}