build: Modify code so it compiles with older Visual Studio
This commit is contained in:
parent
c72b9ec21c
commit
f407cdbe8d
12
src/rtcp.cc
12
src/rtcp.cc
|
|
@ -84,7 +84,10 @@ uvgrtp::rtcp::rtcp(std::shared_ptr<uvgrtp::rtp> rtp, std::string cname, int rce_
|
|||
memcpy(cname_, c, cname.length());
|
||||
uint8_t length = (uint8_t)cname.length();
|
||||
|
||||
cnameItem_ = { 1, length, (uint8_t*)cname_ };
|
||||
cnameItem_.type = 1;
|
||||
cnameItem_.length = length;
|
||||
cnameItem_.data = (uint8_t*)cname_;
|
||||
|
||||
ourItems_.push_back(cnameItem_);
|
||||
}
|
||||
}
|
||||
|
|
@ -1721,10 +1724,14 @@ rtp_error_t uvgrtp::rtcp::generate_report()
|
|||
|
||||
if (sdes_packet)
|
||||
{
|
||||
uvgrtp::frame::rtcp_sdes_chunk chunk;
|
||||
chunk.items = ourItems_;
|
||||
chunk.ssrc = ssrc_;
|
||||
|
||||
// add the SDES packet after the SR/RR, mandatory, must contain CNAME
|
||||
if (!construct_rtcp_header(frame, write_ptr, get_sdes_packet_size(ourItems_), num_receivers_,
|
||||
uvgrtp::frame::RTCP_FT_SDES) ||
|
||||
!construct_sdes_chunk(frame, write_ptr, { ssrc_, ourItems_ }))
|
||||
!construct_sdes_chunk(frame, write_ptr, chunk))
|
||||
{
|
||||
UVG_LOG_ERROR("Failed to add SDES packet");
|
||||
delete[] frame;
|
||||
|
|
@ -1848,7 +1855,6 @@ void uvgrtp::rtcp::set_session_bandwidth(uint32_t kbps)
|
|||
// TODO: This should follow the algorithm specified in RFC 3550 appendix-A.7
|
||||
}
|
||||
|
||||
|
||||
void uvgrtp::rtcp::set_payload_size(size_t mtu_size)
|
||||
{
|
||||
mtu_size_ = mtu_size;
|
||||
|
|
|
|||
|
|
@ -152,27 +152,28 @@ std::string uvgrtp::socket::get_socket_path_string() const
|
|||
|
||||
std::string uvgrtp::socket::sockaddr_to_string(const sockaddr_in& addr) const
|
||||
{
|
||||
char* c_string = new char[INET_ADDRSTRLEN];
|
||||
memset(c_string, 0, INET_ADDRSTRLEN);
|
||||
int addr_len = INET_ADDRSTRLEN;
|
||||
|
||||
switch (addr.sin_family)
|
||||
if (addr.sin_family == AF_INET6)
|
||||
{
|
||||
case AF_INET:
|
||||
{
|
||||
inet_ntop(AF_INET, &addr.sin_addr, c_string, INET_ADDRSTRLEN);
|
||||
break;
|
||||
}
|
||||
case AF_INET6:
|
||||
{
|
||||
inet_ntop(AF_INET6, &addr.sin_addr, c_string, INET_ADDRSTRLEN);
|
||||
break;
|
||||
}
|
||||
addr_len = INET6_ADDRSTRLEN;
|
||||
}
|
||||
|
||||
std::string string(c_string);
|
||||
char* addr_string = new char[addr_len];
|
||||
memset(addr_string, 0, addr_len);
|
||||
|
||||
#ifdef WIN32
|
||||
const void* pvoid_sin_addr = &addr.sin_addr;
|
||||
PVOID pvoid_sin_addr = const_cast<PVOID>(pvoid_sin_addr);
|
||||
inet_ntop(addr.sin_family, &pvoid_sin_addr, addr_string, addr_len);
|
||||
#else
|
||||
inet_ntop(addr.sin_family, &addr.sin_addr, addr_string, addr_len);
|
||||
#endif
|
||||
|
||||
std::string string(addr_string);
|
||||
string.append(":" + std::to_string(ntohs(addr.sin_port)));
|
||||
|
||||
delete[] c_string;
|
||||
delete[] addr_string;
|
||||
return string;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue