Skip to content

Commit

Permalink
vcap/rtsp: small fixes
Browse files Browse the repository at this point in the history
- includes
- do not use TRUE/FALSE
- make decode_frame_by_pt static
  • Loading branch information
MartinPulec committed Jul 15, 2024
1 parent 209c6fd commit f4ee36c
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/video_capture/rtsp.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,15 @@
* ffmpeg -re -f lavfi -i smptebars=s=1920x1080 -vcodec libx264 -tune zerolatency -f rtsp rtsp://localhost:8554/mystream
*/

#include <assert.h> // for assert
#include <errno.h> // for ETIMEDOUT
#include <pthread.h>
#include <signal.h>
#include <stdbool.h>
#include <stdint.h> // for uint8_t, uint32_t
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <time.h> // for timespec

#include "audio/types.h"
#include "config.h"
Expand Down Expand Up @@ -160,8 +162,6 @@ void getNewLine(const char* buffer, int* i, char* line);
void
rtsp_keepalive(void *state);

int decode_frame_by_pt(struct coded_data *cdata, void *decode_data, struct pbuf_stats *);

static void vidcap_rtsp_done(void *state);

static const uint8_t start_sequence[] = { 0, 0, 0, 1 };
Expand Down Expand Up @@ -299,16 +299,18 @@ keep_alive_thread(void *arg){
return NULL;
}

int decode_frame_by_pt(struct coded_data *cdata, void *decode_data, struct pbuf_stats *stats) {
UNUSED(stats);
static int
decode_frame_by_pt(struct coded_data *cdata, void *decode_data,
struct pbuf_stats *stats)
{ UNUSED(stats);
rtp_packet *pckt = NULL;
pckt = cdata->data;
struct decode_data_h264 *d = (struct decode_data_h264 *) decode_data;
if (pckt->pt == d->video_pt) {
return decode_frame_h264(cdata,decode_data);
} else {
error_msg("Wrong Payload type: %u\n", pckt->pt);
return FALSE;
return 0;
}
}

Expand Down Expand Up @@ -568,7 +570,7 @@ vidcap_rtsp_init(struct vidcap_params *params, void **state) {
if (strstr(item, "rtp_rx_port=") == item) {
s->vrtsp_state.port = atoi(strchr(item, '=') + 1);
} else if (strcmp(item, "decompress") == 0) {
s->vrtsp_state.decompress = TRUE;
s->vrtsp_state.decompress = true;
} else if (strstr(item, "size=")) {
MSG(WARNING, "size= parameter is not used! Will be removed in "
"future!\n");
Expand Down Expand Up @@ -1080,7 +1082,7 @@ vidcap_rtsp_done(void *state) {

pthread_mutex_lock(&s->lock);
pthread_mutex_lock(&s->vrtsp_state.lock);
s->should_exit = TRUE;
s->should_exit = true;
pthread_mutex_unlock(&s->vrtsp_state.lock);
pthread_mutex_unlock(&s->lock);

Expand Down

0 comments on commit f4ee36c

Please sign in to comment.