common: Fix warnings given by GCC on Linux
This commit is contained in:
parent
f915b2aa17
commit
eb5e7c7c2f
|
@ -162,14 +162,6 @@ namespace uvgrtp {
|
|||
rtp_frame *alloc_rtp_frame(size_t payload_len);
|
||||
rtp_frame *alloc_rtp_frame(size_t payload_len, size_t pz_size);
|
||||
|
||||
/* Allocate ZRTP frame
|
||||
* Parameter "payload_size" defines the length of the frame
|
||||
*
|
||||
* Return pointer to frame on success
|
||||
* Return nullptr on error and set rtp_errno to:
|
||||
* RTP_MEMORY_ERROR if allocation of memory failed
|
||||
* RTP_INVALID_VALUE if "payload_size" is 0 */
|
||||
zrtp_frame *alloc_zrtp_frame(size_t payload_size);
|
||||
|
||||
/* Deallocate RTP frame
|
||||
*
|
||||
|
@ -177,11 +169,22 @@ namespace uvgrtp {
|
|||
* Return RTP_INVALID_VALUE if "frame" is nullptr */
|
||||
rtp_error_t dealloc_frame(uvgrtp::frame::rtp_frame *frame);
|
||||
|
||||
|
||||
/* Allocate ZRTP frame
|
||||
* Parameter "payload_size" defines the length of the frame
|
||||
*
|
||||
* Return pointer to frame on success
|
||||
* Return nullptr on error and set rtp_errno to:
|
||||
* RTP_MEMORY_ERROR if allocation of memory failed
|
||||
* RTP_INVALID_VALUE if "payload_size" is 0 */
|
||||
void* alloc_zrtp_frame(size_t payload_size);
|
||||
|
||||
|
||||
/* Deallocate ZRTP frame
|
||||
*
|
||||
* Return RTP_OK on successs
|
||||
* Return RTP_INVALID_VALUE if "frame" is nullptr */
|
||||
rtp_error_t dealloc_frame(uvgrtp::frame::zrtp_frame *frame);
|
||||
rtp_error_t dealloc_frame(uvgrtp::frame::zrtp_frame* frame);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -318,7 +318,7 @@ namespace uvgrtp {
|
|||
|
||||
rtp_error_t start_components();
|
||||
|
||||
int get_default_bandwidth_kbps(rtp_format_t fmt);
|
||||
uint32_t get_default_bandwidth_kbps(rtp_format_t fmt);
|
||||
|
||||
uint32_t key_;
|
||||
|
||||
|
|
|
@ -206,7 +206,7 @@ namespace uvgrtp {
|
|||
/* Getter for interval_ms_, which is calculated by set_session_bandwidth */
|
||||
uint32_t get_rtcp_interval_ms() const;
|
||||
|
||||
void set_session_bandwidth(int kbps);
|
||||
void set_session_bandwidth(uint32_t kbps);
|
||||
|
||||
/* Return SSRCs of all participants */
|
||||
std::vector<uint32_t> get_participants() const;
|
||||
|
@ -495,7 +495,7 @@ namespace uvgrtp {
|
|||
|
||||
bool active_;
|
||||
|
||||
int interval_ms_;
|
||||
uint32_t interval_ms_;
|
||||
|
||||
std::mutex packet_mutex_;
|
||||
|
||||
|
|
15
src/frame.cc
15
src/frame.cc
|
@ -11,8 +11,15 @@ uvgrtp::frame::rtp_frame *uvgrtp::frame::alloc_rtp_frame()
|
|||
{
|
||||
uvgrtp::frame::rtp_frame *frame = new uvgrtp::frame::rtp_frame;
|
||||
|
||||
std::memset(&frame->header, 0, sizeof(uvgrtp::frame::rtp_header));
|
||||
std::memset(frame, 0, sizeof(uvgrtp::frame::rtp_frame));
|
||||
frame->header.version = 0;
|
||||
frame->header.padding = 0;
|
||||
frame->header.ext = 0;
|
||||
frame->header.cc = 0;
|
||||
frame->header.marker = 0;
|
||||
frame->header.payload = 0;
|
||||
frame->header.seq = 0;
|
||||
frame->header.timestamp = 0;
|
||||
frame->header.ssrc = 0;
|
||||
|
||||
frame->payload = nullptr;
|
||||
frame->probation = nullptr;
|
||||
|
@ -75,7 +82,7 @@ rtp_error_t uvgrtp::frame::dealloc_frame(uvgrtp::frame::rtp_frame *frame)
|
|||
return RTP_OK;
|
||||
}
|
||||
|
||||
uvgrtp::frame::zrtp_frame *uvgrtp::frame::alloc_zrtp_frame(size_t size)
|
||||
void* uvgrtp::frame::alloc_zrtp_frame(size_t size)
|
||||
{
|
||||
if (size == 0) {
|
||||
rtp_errno = RTP_INVALID_VALUE;
|
||||
|
@ -94,7 +101,7 @@ uvgrtp::frame::zrtp_frame *uvgrtp::frame::alloc_zrtp_frame(size_t size)
|
|||
return frame;
|
||||
}
|
||||
|
||||
rtp_error_t uvgrtp::frame::dealloc_frame(uvgrtp::frame::zrtp_frame *frame)
|
||||
rtp_error_t uvgrtp::frame::dealloc_frame(uvgrtp::frame::zrtp_frame* frame)
|
||||
{
|
||||
if (!frame)
|
||||
return RTP_INVALID_VALUE;
|
||||
|
|
|
@ -304,7 +304,7 @@ rtp_error_t uvgrtp::frame_queue::flush_queue()
|
|||
|
||||
std::chrono::nanoseconds packet_interval = frame_interval_/ active_->packets.size();
|
||||
|
||||
for (int i = 0; i < active_->packets.size(); ++i)
|
||||
for (size_t i = 0; i < active_->packets.size(); ++i)
|
||||
{
|
||||
std::chrono::high_resolution_clock::time_point next_packet = this_moment + i * packet_interval;
|
||||
|
||||
|
|
|
@ -661,7 +661,7 @@ rtp_error_t uvgrtp::media_stream::init_srtp_with_zrtp(int rce_flags, int type, s
|
|||
}
|
||||
|
||||
|
||||
int uvgrtp::media_stream::get_default_bandwidth_kbps(rtp_format_t fmt)
|
||||
uint32_t uvgrtp::media_stream::get_default_bandwidth_kbps(rtp_format_t fmt)
|
||||
{
|
||||
int bandwidth = 50;
|
||||
switch (fmt) {
|
||||
|
|
|
@ -60,7 +60,7 @@ void uvgrtp::reception_flow::create_ring_buffer()
|
|||
destroy_ring_buffer();
|
||||
size_t elements = buffer_size_kbytes_ / RECV_BUFFER_SIZE;
|
||||
|
||||
for (int i = 0; i < elements; ++i)
|
||||
for (size_t i = 0; i < elements; ++i)
|
||||
{
|
||||
ring_buffer_.push_back({ new uint8_t[RECV_BUFFER_SIZE] , 0 });
|
||||
}
|
||||
|
@ -68,7 +68,7 @@ void uvgrtp::reception_flow::create_ring_buffer()
|
|||
|
||||
void uvgrtp::reception_flow::destroy_ring_buffer()
|
||||
{
|
||||
for (int i = 0; i < ring_buffer_.size(); ++i)
|
||||
for (size_t i = 0; i < ring_buffer_.size(); ++i)
|
||||
{
|
||||
delete[] ring_buffer_.at(i).data;
|
||||
}
|
||||
|
|
|
@ -1804,7 +1804,7 @@ uint32_t uvgrtp::rtcp::get_rtcp_interval_ms() const
|
|||
return interval_ms_;
|
||||
}
|
||||
|
||||
void uvgrtp::rtcp::set_session_bandwidth(int kbps)
|
||||
void uvgrtp::rtcp::set_session_bandwidth(uint32_t kbps)
|
||||
{
|
||||
interval_ms_ = 1000*360 / kbps; // the reduced minimum (see section 6.2 in RFC 3550)
|
||||
|
||||
|
|
|
@ -37,14 +37,7 @@ uint32_t uvgrtp::get_sdes_packet_size(const std::vector<uvgrtp::frame::rtcp_sdes
|
|||
frame_size += (uint32_t)items.size() * 2; /* sdes item type + length, both take one byte */
|
||||
for (auto& item : items)
|
||||
{
|
||||
if (item.length <= 255)
|
||||
{
|
||||
frame_size += item.length;
|
||||
}
|
||||
else
|
||||
{
|
||||
UVG_LOG_ERROR("SDES item text must not be longer than 255 characters");
|
||||
}
|
||||
frame_size += item.length;
|
||||
}
|
||||
|
||||
/* each chunk must end to a zero octet so 4 zeros is only option
|
||||
|
@ -139,18 +132,15 @@ bool uvgrtp::construct_sdes_chunk(uint8_t* frame, size_t& ptr,
|
|||
|
||||
for (auto& item : chunk.items)
|
||||
{
|
||||
if (item.length <= 255)
|
||||
if (item.type == 1)
|
||||
{
|
||||
if (item.type == 1)
|
||||
{
|
||||
have_cname = true;
|
||||
}
|
||||
|
||||
frame[ptr++] = item.type;
|
||||
frame[ptr++] = item.length;
|
||||
memcpy(frame + ptr, item.data, item.length);
|
||||
ptr += item.length;
|
||||
have_cname = true;
|
||||
}
|
||||
|
||||
frame[ptr++] = item.type;
|
||||
frame[ptr++] = item.length;
|
||||
memcpy(frame + ptr, item.data, item.length);
|
||||
ptr += item.length;
|
||||
}
|
||||
|
||||
ptr += (4 - ptr % 4);
|
||||
|
|
|
@ -20,10 +20,10 @@ uvgrtp::zrtp_msg::zrtp_message::~zrtp_message()
|
|||
UVG_LOG_DEBUG("Freeing zrtp message...");
|
||||
|
||||
if (frame_)
|
||||
(void)uvgrtp::frame::dealloc_frame(frame_);
|
||||
(void)uvgrtp::frame::dealloc_frame((uvgrtp::frame::zrtp_frame*)frame_);
|
||||
|
||||
if (rframe_)
|
||||
(void)uvgrtp::frame::dealloc_frame(rframe_);
|
||||
(void)uvgrtp::frame::dealloc_frame((uvgrtp::frame::zrtp_frame*)rframe_);
|
||||
}
|
||||
|
||||
rtp_error_t uvgrtp::zrtp_msg::zrtp_message::send_msg(std::shared_ptr<uvgrtp::socket> socket, sockaddr_in& addr)
|
||||
|
|
|
@ -34,8 +34,8 @@ namespace uvgrtp {
|
|||
void set_zrtp_start(uvgrtp::zrtp_msg::zrtp_msg& start, zrtp_session_t& session,
|
||||
std::string msgblock);
|
||||
|
||||
uvgrtp::frame::zrtp_frame* frame_;
|
||||
uvgrtp::frame::zrtp_frame* rframe_;
|
||||
void* frame_;
|
||||
void* rframe_;
|
||||
size_t len_;
|
||||
size_t rlen_;
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue