Initialize fields before starting a thread
To avoid data races. Reported by TSAN.
This commit is contained in:
parent
f33d37976c
commit
33fbdc86c7
1 changed files with 3 additions and 3 deletions
|
@ -241,6 +241,9 @@ sc_v4l2_sink_open(struct sc_v4l2_sink *vs) {
|
||||||
goto error_av_frame_free;
|
goto error_av_frame_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
vs->header_written = false;
|
||||||
|
vs->stopped = false;
|
||||||
|
|
||||||
LOGD("Starting v4l2 thread");
|
LOGD("Starting v4l2 thread");
|
||||||
ok = sc_thread_create(&vs->thread, run_v4l2_sink, "v4l2", vs);
|
ok = sc_thread_create(&vs->thread, run_v4l2_sink, "v4l2", vs);
|
||||||
if (!ok) {
|
if (!ok) {
|
||||||
|
@ -248,9 +251,6 @@ sc_v4l2_sink_open(struct sc_v4l2_sink *vs) {
|
||||||
goto error_av_packet_free;
|
goto error_av_packet_free;
|
||||||
}
|
}
|
||||||
|
|
||||||
vs->header_written = false;
|
|
||||||
vs->stopped = false;
|
|
||||||
|
|
||||||
LOGI("v4l2 sink started to device: %s", vs->device_name);
|
LOGI("v4l2 sink started to device: %s", vs->device_name);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
Loading…
Reference in a new issue