diff --git a/src/debug.hh b/src/debug.hh index 990275f..fe06b21 100644 --- a/src/debug.hh +++ b/src/debug.hh @@ -50,7 +50,7 @@ static inline void win_get_last_error(void) #define debug(level, fmt, ...) \ fprintf(stderr, "[RTPLIB][%s][%s::%s] " fmt "\n", level, \ - className(__PRETTY_FUNCTION__), __func__, ##__VA_ARGS__) + "", __func__, ##__VA_ARGS__) #ifndef NDEBUG #define LOG_DEBUG(fmt, ...) debug(LOG_LEVEL_DEBUG, fmt, ##__VA_ARGS__) diff --git a/src/formats/hevc.cc b/src/formats/hevc.cc index 50e9949..560cbd1 100644 --- a/src/formats/hevc.cc +++ b/src/formats/hevc.cc @@ -29,7 +29,7 @@ #endif #ifndef __BYTE_ORDER -#warning "setting byte order to little endian" +//#warning "setting byte order to little endian" #define __BYTE_ORDER __LITTLE_ENDIAN #endif diff --git a/src/frame.hh b/src/frame.hh index eef73a8..45803c9 100644 --- a/src/frame.hh +++ b/src/frame.hh @@ -112,30 +112,30 @@ namespace kvz_rtp { struct rtcp_header header; uint32_t sender_ssrc; struct rtcp_sender_info s_info; - struct rtcp_report_block blocks[0]; + struct rtcp_report_block blocks[1]; }; PACKED_STRUCT(rtcp_receiver_frame) { struct rtcp_header header; uint32_t sender_ssrc; - struct rtcp_report_block blocks[0]; + struct rtcp_report_block blocks[1]; }; PACKED_STRUCT(rtcp_sdes_item) { uint8_t type; uint8_t length; - uint8_t data[0]; + uint8_t data[1]; }; PACKED_STRUCT(rtcp_sdes_frame) { struct rtcp_header header; uint32_t sender_ssrc; - struct rtcp_sdes_item items[0]; + struct rtcp_sdes_item items[1]; }; PACKED_STRUCT(rtcp_bye_frame) { struct rtcp_header header; - uint32_t ssrc[0]; + uint32_t ssrc[1]; }; PACKED_STRUCT(rtcp_app_frame) { @@ -147,7 +147,7 @@ namespace kvz_rtp { uint32_t ssrc; uint8_t name[4]; - uint8_t payload[0]; + uint8_t payload[1]; }; PACKED_STRUCT(zrtp_frame) { @@ -156,7 +156,7 @@ namespace kvz_rtp { uint16_t seq; uint32_t magic; uint32_t ssrc; - uint8_t payload[0]; + uint8_t payload[1]; }; /* Allocate an RTP frame diff --git a/src/queue.hh b/src/queue.hh index 0cb6328..fbdde36 100644 --- a/src/queue.hh +++ b/src/queue.hh @@ -10,6 +10,10 @@ #include "sender.hh" #include "util.hh" +#if defined(_MSC_VER) +typedef SSIZE_T ssize_t; +#endif + const int MAX_MSG_COUNT = 5000; const int MAX_QUEUED_MSGS = 10; const int MAX_CHUNK_COUNT = 4; diff --git a/src/rtcp.cc b/src/rtcp.cc index 36f4a77..e8a95c3 100644 --- a/src/rtcp.cc +++ b/src/rtcp.cc @@ -77,10 +77,9 @@ rtp_error_t kvz_rtp::rtcp::add_participant(std::string dst_addr, int dst_port, i * * This means that the socket is listened for 5s at a time and after the timeout, * Send Report is sent to all participants */ - struct timeval tv = { - .tv_sec = 3, - .tv_usec = 0 - }; + struct timeval tv; + tv.tv_sec = 3; + tv.tv_usec = 0; if ((ret = p->socket->setsockopt(SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv))) != RTP_OK) return ret; diff --git a/src/socket.cc b/src/socket.cc index ea642f2..3127c4d 100644 --- a/src/socket.cc +++ b/src/socket.cc @@ -1,5 +1,6 @@ #ifdef _WIN32 #include +#include #include #else #include @@ -138,7 +139,7 @@ socket_t& kvz_rtp::socket::get_raw_socket() rtp_error_t kvz_rtp::socket::__sendto(sockaddr_in& addr, uint8_t *buf, size_t buf_len, int flags, int *bytes_sent) { - int nsend; + int nsend = 0; #ifdef __linux__ if ((nsend = ::sendto(socket_, buf, buf_len, flags, (const struct sockaddr *)&addr, sizeof(addr_))) == -1) { @@ -162,6 +163,7 @@ rtp_error_t kvz_rtp::socket::__sendto(sockaddr_in& addr, uint8_t *buf, size_t bu *bytes_sent = -1; return RTP_SEND_ERROR; } + nsend = sent_bytes; #endif if (bytes_sent) diff --git a/src/util.hh b/src/util.hh index 09cfa1d..c5dae8b 100644 --- a/src/util.hh +++ b/src/util.hh @@ -13,12 +13,16 @@ #include #include +#if defined(_MSC_VER) +typedef SSIZE_T ssize_t; +#endif + #if defined(__MINGW32__) || defined(__MINGW64__) || defined(__linux__) #define PACKED_STRUCT(name) \ struct __attribute__((packed)) name #else -#warning "structures are not packed!" +//#warning "structures are not packed!" #define PACKED_STRUCT(name) struct name #endif