提交 33fbdc86 编写于 作者: R Romain Vimont

Initialize fields before starting a thread

To avoid data races.

Reported by TSAN.
上级 f33d3797
......@@ -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;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册