Skip to content

Display and control your Android device

Initialize fields before starting a thread

Romain Vimont33fbdc86c7c6
diff --git a/app/src/v4l2_sink.c b/app/src/v4l2_sink.c
index bd184b4d..a276b79c 100644
--- a/app/src/v4l2_sink.c
+++ b/app/src/v4l2_sink.c
@@ -241,6 +241,9 @@ sc_v4l2_sink_open(struct sc_v4l2_sink *vs) {
goto error_av_frame_free;
}
+ vs->header_written = false;
+ vs->stopped = false;
+
LOGD("Starting v4l2 thread");
ok = sc_thread_create(&vs->thread, run_v4l2_sink, "v4l2", vs);
if (!ok) {
@@ -248,9 +251,6 @@ sc_v4l2_sink_open(struct sc_v4l2_sink *vs) {
goto error_av_packet_free;
}
- vs->header_written = false;
- vs->stopped = false;
-
LOGI("v4l2 sink started to device: %s", vs->device_name);
return true;