fixed Win compile warnings (from CI)

This commit is contained in:
Martin Pulec
2022-08-11 08:33:34 +02:00
parent f5114ab793
commit 04c2d245d0
6 changed files with 24 additions and 22 deletions

View File

@@ -948,8 +948,8 @@ static void r10k_to_x2rgb10le(AVFrame * __restrict out_frame, unsigned char * __
{
int src_linesize = vc_get_linesize(width, R10k);
for (int y = 0; y < height; ++y) {
uint32_t *src = (uint32_t *) (in_data + y * src_linesize);
uint32_t *dst = (uint32_t *) (out_frame->data[0] + out_frame->linesize[0] * y);
uint32_t *src = (uint32_t *)(void *) (in_data + y * src_linesize);
uint32_t *dst = (uint32_t *)(void *) (out_frame->data[0] + out_frame->linesize[0] * y);
for (int x = 0; x < width; ++x) {
*dst++ = htonl(*src++); /// @todo worked, but should be AFAIK htonl(*src++)>>2
}

View File

@@ -127,7 +127,7 @@ static bool set_fec(struct tx *tx, const char *fec);
static void fec_check_messages(struct tx *tx);
struct rate_limit_dyn {
long avg_frame_size; ///< moving average
unsigned long avg_frame_size; ///< moving average
long long last_excess; ///< nr of frames last excessive frame was emitted
static constexpr int EXCESS_GAP = 4; ///< minimal gap between excessive frames
};

View File

@@ -431,7 +431,6 @@ struct video_pattern_generator {
};
struct still_image_video_pattern_generator : public video_pattern_generator {
constexpr static auto delarr_deleter = [](unsigned char *ptr){ delete [] ptr; };
still_image_video_pattern_generator(std::string const & config, int w, int h, codec_t c, int o)
: width(w), height(h), color_spec(c), offset(o)
{

View File

@@ -185,7 +185,7 @@ class Video_mixer{
public:
enum class Layout{ Invalid, Tiled, One_big };
Video_mixer(int width, int height, codec_t color_space, Layout l = Layout::Tiled);
Video_mixer(int width, int height, Layout l = Layout::Tiled);
void process_frame(unique_frame&& f);
void get_mixed(video_frame *result);
@@ -205,7 +205,6 @@ private:
unsigned width;
unsigned height;
codec_t color_space;
Layout layout = Layout::Tiled;
uint32_t primary_ssrc = 0;
@@ -216,10 +215,9 @@ private:
std::map<uint32_t, Participant> participants;
};
Video_mixer::Video_mixer(int width, int height, codec_t color_space, Layout layout):
Video_mixer::Video_mixer(int width, int height, Layout layout):
width(width),
height(height),
color_space(color_space),
layout(layout)
{
mixed_luma.create(cv::Size(width, height), CV_8UC1);
@@ -405,7 +403,7 @@ const char *layout_get_name(Video_mixer::Layout layout){
}//anon namespace
static constexpr std::chrono::milliseconds SOURCE_TIMEOUT(500);
[[maybe_unused]] static constexpr std::chrono::milliseconds SOURCE_TIMEOUT(500);
static constexpr unsigned int IN_QUEUE_MAX_BUFFER_LEN = 5;
struct state_conference_common{
@@ -531,7 +529,7 @@ static void check_reconf(struct state_conference_common *s, struct video_desc de
static void display_conference_worker(std::shared_ptr<state_conference_common> s){
PROFILE_FUNC;
Video_mixer mixer(s->desc.width, s->desc.height, UYVY, s->layout);
Video_mixer mixer(s->desc.width, s->desc.height, s->layout);
auto next_frame_time = clock::now() + std::chrono::hours(1); //workaround for gcc bug 58931
auto last_frame_time = clock::time_point::min();
@@ -571,7 +569,7 @@ static void display_conference_worker(std::shared_ptr<state_conference_common> s
} else if (key == "info"){
auto ssrcs = mixer.get_participant_ssrc_list();
log_msg(LOG_LEVEL_NOTICE, "Conference layout: %s\n", layout_get_name(mixer.get_layout()));
log_msg(LOG_LEVEL_NOTICE, "%ld participants \n", ssrcs.size());
log_msg(LOG_LEVEL_NOTICE, "%zu participants \n", ssrcs.size());
for(const auto& p : ssrcs){
log_msg(LOG_LEVEL_NOTICE, "%s %x\n", p == mixer.get_primary_ssrc() ? "*" : " ", p);
}

View File

@@ -187,6 +187,9 @@ void ug_control_connection_done(struct ug_connection *c) {
c->should_exit = true;
char ch = 0;
int ret = send(c->should_exit_fd[1], &ch, 1, MSG_DONTWAIT);
if (ret == -1) {
perror("ug_control_connection_done send");
}
c->t.join();
platform_pipe_close(c->should_exit_fd[0]);
platform_pipe_close(c->should_exit_fd[1]);

View File

@@ -4,17 +4,20 @@
#include <stdio.h>
#include <array>
#ifndef __MINGW32__
#ifndef _WIN32
#include <sys/types.h>
#include <sys/time.h>
#include <sys/socket.h>
#include <sys/un.h>
#include <netinet/in.h>
#define CLOSESOCKET close
#define INVALID_SOCKET -1
typedef int fd_t;
#else
#include <winsock2.h>
#include <afunix.h>
#define CLOSESOCKET closesocket
typedef SOCKET fd_t;
#endif
#include <cerrno>
@@ -24,18 +27,17 @@
#define MSG_NOSIGNAL 0
#endif
struct Ipc_frame_reader{
int listen_fd;
int data_fd;
fd_t listen_fd;
fd_t data_fd;
};
Ipc_frame_reader *ipc_frame_reader_new(const char *path){
auto reader = new Ipc_frame_reader();
reader->data_fd = -1;
reader->data_fd = INVALID_SOCKET;
reader->listen_fd = socket(AF_UNIX, SOCK_STREAM, 0);
if(reader->listen_fd == -1){
if(reader->listen_fd == INVALID_SOCKET){
delete reader;
return nullptr;
}
@@ -74,7 +76,7 @@ void ipc_frame_reader_free(struct Ipc_frame_reader *reader){
delete reader;
}
static size_t blocking_read(int fd, char *dst, size_t size){
static size_t blocking_read(fd_t fd, char *dst, size_t size){
size_t bytes_read = 0;
while(bytes_read < size){
@@ -88,7 +90,7 @@ static size_t blocking_read(int fd, char *dst, size_t size){
return bytes_read;
}
static bool socket_read_avail(int fd){
static bool socket_read_avail(fd_t fd){
fd_set fds;
FD_ZERO(&fds);
FD_SET(fd, &fds);
@@ -149,12 +151,12 @@ bool ipc_frame_reader_read(Ipc_frame_reader *reader, Ipc_frame *dst){
}
struct Ipc_frame_writer{
int data_fd;
fd_t data_fd;
};
Ipc_frame_writer *ipc_frame_writer_new(const char *path){
auto writer = new Ipc_frame_writer;
writer->data_fd = -1;
writer->data_fd = INVALID_SOCKET;
sockaddr_un addr;
memset(&addr, 0, sizeof(addr));
@@ -187,7 +189,7 @@ void ipc_frame_writer_free(struct Ipc_frame_writer *writer){
namespace{
void block_write(int fd, void *buf, size_t size){
void block_write(fd_t fd, void *buf, size_t size){
size_t written = 0;
char *src = static_cast<char *>(buf);