fix: GPS采集端修复

This commit is contained in:
nnbcccscdscdsc
2026-04-13 22:33:20 +08:00
parent 2f507a7546
commit 947ecb2a2b
6 changed files with 175 additions and 138 deletions

View File

@@ -745,6 +745,8 @@ int video_pipeline_run(const video_pipeline_config_t *config, video_pipeline_sta
int sws_src_format = -1;
uint32_t hard_backpressure_since_ms = 0;
uint32_t last_soft_drop_log_ms = 0;
const char *gpsd_host = env_or_default("OMNI_GPSD_HOST", "127.0.0.1");
int gps_buffer_started = 0;
memset(&sender, 0, sizeof(sender));
if (stats == NULL) {
@@ -792,6 +794,11 @@ int video_pipeline_run(const video_pipeline_config_t *config, video_pipeline_sta
video_pipeline_set_errno_error(stats, "failed to start video sender");
goto cleanup;
}
if (gps_buffer_init(gpsd_host) != 0) {
fprintf(stderr, "[video_pipeline] failed to start GPS buffer using %s:2947\n", gpsd_host);
} else {
gps_buffer_started = 1;
}
pthread_mutex_lock(&stats->mutex);
stats->connected = 1;
@@ -1070,6 +1077,9 @@ cleanup:
pthread_mutex_lock(&stats->mutex);
stats->connected = 0;
pthread_mutex_unlock(&stats->mutex);
if (gps_buffer_started) {
gps_buffer_cleanup();
}
if (fd >= 0) {
(void) ioctl(fd, VIDIOC_STREAMOFF, &type);
}