Fix more warnings

This commit is contained in:
Cameron Gutman
2022-11-20 20:40:29 -06:00
parent c985b9ea0d
commit 1feeab9c71
5 changed files with 8 additions and 20 deletions

View File

@@ -94,16 +94,16 @@ static int load_unique_id(const char* keyDirectory) {
snprintf(uniqueFilePath, PATH_MAX, "%s/%s", keyDirectory, UNIQUE_FILE_NAME);
FILE *fd = fopen(uniqueFilePath, "r");
if (fd == NULL) {
if (fd == NULL || fread(unique_id, UNIQUEID_CHARS, 1, fd) != UNIQUEID_CHARS) {
snprintf(unique_id,UNIQUEID_CHARS+1,"0123456789ABCDEF");
if (fd)
fclose(fd);
fd = fopen(uniqueFilePath, "w");
if (fd == NULL)
return GS_FAILED;
fwrite(unique_id, UNIQUEID_CHARS, 1, fd);
} else {
fread(unique_id, UNIQUEID_CHARS, 1, fd);
}
fclose(fd);
unique_id[UNIQUEID_CHARS] = 0;

View File

@@ -34,7 +34,7 @@ static int channelCount;
static int samplesPerFrame;
static int omx_renderer_init(int audioConfiguration, POPUS_MULTISTREAM_CONFIGURATION opusConfig, void* context, int arFlags) {
int rc, error;
int rc;
OMX_ERRORTYPE err;
unsigned char omxMapping[AUDIO_CONFIGURATION_MAX_CHANNEL_COUNT];
char* componentName = "audio_render";

View File

@@ -38,7 +38,8 @@ static int sigFd;
static int loop_sig_handler(int fd) {
struct signalfd_siginfo info;
read(fd, &info, sizeof(info));
if (read(fd, &info, sizeof(info)) != sizeof(info))
return LOOP_RETURN;
switch (info.ssi_signo) {
case SIGINT:
case SIGTERM:
@@ -75,7 +76,7 @@ void loop_remove_fd(int fd) {
numFds--;
int fdindex;
for (int i=0;i<numFds;i++) {
for (int i=0;i<=numFds;i++) {
if (fds[i].fd == fd) {
fdindex = i;
break;

View File

@@ -78,8 +78,6 @@ static void output_callback(MMAL_PORT_T *port, MMAL_BUFFER_HEADER_T *buf) {
}
static int decoder_renderer_setup(int videoFormat, int width, int height, int redrawRate, void* context, int drFlags) {
MMAL_STATUS_T status;
if (videoFormat != VIDEO_FORMAT_H264) {
fprintf(stderr, "Video format not supported\n");
return -1;

View File

@@ -45,7 +45,7 @@ static TUNNEL_T tunnel[2];
static COMPONENT_T *list[3];
static ILCLIENT_T *client;
static COMPONENT_T *video_decode = NULL, *video_scheduler = NULL, *video_render = NULL;
static COMPONENT_T *video_decode = NULL, *video_render = NULL;
static int port_settings_changed;
static int first_packet;
@@ -60,8 +60,6 @@ static int decoder_renderer_setup(int videoFormat, int width, int height, int re
gs_sps_init(width, height);
OMX_VIDEO_PARAM_PORTFORMATTYPE format;
OMX_TIME_CONFIG_CLOCKSTATETYPE cstate;
COMPONENT_T *clock = NULL;
memset(list, 0, sizeof(list));
memset(tunnel, 0, sizeof(tunnel));
@@ -130,13 +128,6 @@ static int decoder_renderer_setup(int videoFormat, int width, int height, int re
latencyTarget.nInterFactor = 500;
latencyTarget.nAdjCap = 20;
OMX_CONFIG_DISPLAYREGIONTYPE displayRegion;
displayRegion.nSize = sizeof(OMX_PARAM_PORTDEFINITIONTYPE);
displayRegion.nVersion.nVersion = OMX_VERSION;
displayRegion.nPortIndex = 90;
displayRegion.fullscreen = OMX_TRUE;
displayRegion.mode = OMX_DISPLAY_SET_FULLSCREEN;
if(OMX_SetParameter(ILC_GET_HANDLE(video_render), OMX_IndexConfigLatencyTarget, &latencyTarget) != OMX_ErrorNone) {
fprintf(stderr, "Failed to set video render parameters\n");
exit(EXIT_FAILURE);
@@ -195,8 +186,6 @@ static int decoder_renderer_setup(int videoFormat, int width, int height, int re
}
static void decoder_renderer_cleanup() {
int status = 0;
OMX_BUFFERHEADERTYPE *buf;
if((buf = ilclient_get_input_buffer(video_decode, 130, 1)) == NULL){
fprintf(stderr, "Can't get video buffer\n");