Merge branch 'VisualStudioMeme' into 'master'

Visual studio meme

See merge request TIE/ultravideo/kvz-rtplib!1
This commit is contained in:
Aaro Altonen 2020-03-03 07:17:57 +02:00
commit 54c603478d
7 changed files with 24 additions and 15 deletions

View File

@ -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__)

View File

@ -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

View File

@ -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

View File

@ -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;

View File

@ -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;

View File

@ -1,5 +1,6 @@
#ifdef _WIN32
#include <winsock2.h>
#include <Ws2tcpip.h>
#include <ws2def.h>
#else
#include <unistd.h>
@ -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)

View File

@ -13,12 +13,16 @@
#include <cstdio>
#include <string>
#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