common: Compile with c++11 and better debug prints

This commit is contained in:
Joni Räsänen 2021-06-15 10:12:43 +03:00
parent 5a80f616f4
commit 1b12e51fa0
5 changed files with 26 additions and 8 deletions

View File

@ -41,7 +41,7 @@ rtp_error_t uvgrtp::formats::h265::make_aggregation_pkt()
/* Only one buffer in the vector -> no need to create an aggregation packet */
if (aggr_pkt_info_.nalus.size() == 1) {
if ((ret = fqueue_->enqueue_message(aggr_pkt_info_.nalus)) != RTP_OK) {
LOG_ERROR("Failed to enqueue Single NAL Unit packet!");
LOG_ERROR("Failed to enqueue Single h265 NAL Unit packet!");
return ret;
}
@ -128,7 +128,7 @@ rtp_error_t uvgrtp::formats::h265::handle_small_packet(uint8_t* data, size_t dat
rtp_error_t ret = RTP_OK;
if (aggr_pkt_info_.nalus.empty()) {
if ((ret = fqueue_->enqueue_message(data, data_len)) != RTP_OK) {
LOG_ERROR("Failed to enqueue Single NAL Unit packet!");
LOG_ERROR("Failed to enqueue Single h265 NAL Unit packet! Size: %lu", data_len);
return ret;
}
}
@ -159,4 +159,4 @@ rtp_error_t uvgrtp::formats::h265::construct_format_header_divide_fus(uint8_t* d
data_left -= uvgrtp::frame::HEADER_SIZE_H265_NAL;
return divide_frame_to_fus(data, data_left, data_pos, payload_size, buffers, headers->fu_headers);
}
}

View File

@ -261,7 +261,7 @@ rtp_error_t uvgrtp::formats::h26x::push_h26x_frame(uint8_t *data, size_t data_le
return push_nal_unit(data + r_off, data_len, false);
} else {
if ((ret = fqueue_->enqueue_message(data + r_off, data_len - r_off)) != RTP_OK) {
LOG_ERROR("Failed to enqueue Single NAL Unit packet!");
LOG_ERROR("Failed to enqueue Single h26x NAL Unit packet!");
return ret;
}
@ -403,4 +403,4 @@ void uvgrtp::formats::h26x::initialize_fu_headers(uint8_t nal_type, uint8_t fu_h
fu_headers[0] = (uint8_t)((1 << 7) | nal_type);
fu_headers[1] = nal_type;
fu_headers[2] = (uint8_t)((1 << 6) | nal_type);
}
}

View File

@ -118,7 +118,12 @@ rtp_error_t uvgrtp::pkt_dispatcher::install_aux_handler(
if (packet_handlers_.find(key) == packet_handlers_.end())
return RTP_INVALID_VALUE;
packet_handlers_[key].auxiliary.push_back({ arg, handler, getter });
auxiliary_handler aux;
aux.arg = arg;
aux.getter = getter;
aux.handler = handler;
packet_handlers_[key].auxiliary.push_back(aux);
return RTP_OK;
}

View File

@ -6,6 +6,7 @@
#include <mutex>
#include <unordered_map>
#include <vector>
namespace uvgrtp {

View File

@ -262,8 +262,17 @@ rtp_error_t uvgrtp::frame_queue::deinit_transaction()
rtp_error_t uvgrtp::frame_queue::enqueue_message(uint8_t *message, size_t message_len, bool set_marker)
{
if (!message || !message_len)
return RTP_INVALID_VALUE;
if (message == nullptr)
{
LOG_ERROR("Tried to enqueue nullptr");
return RTP_INVALID_VALUE;
}
if (message_len == 0)
{
LOG_ERROR("Tried to enqueue zero length message");
return RTP_INVALID_VALUE;
}
/* Create buffer vector where the full packet is constructed
* and which is then pushed to "active_"'s pkt_vec structure */
@ -310,7 +319,10 @@ rtp_error_t uvgrtp::frame_queue::enqueue_message(uint8_t *message, size_t messag
rtp_error_t uvgrtp::frame_queue::enqueue_message(std::vector<std::pair<size_t, uint8_t *>>& buffers)
{
if (!buffers.size())
{
LOG_ERROR("Tried to enqueue an empty buffer");
return RTP_INVALID_VALUE;
}
/* Create buffer vector where the full packet is constructed
* and which is then pushed to "active_"'s pkt_vec structure */