Fix crash with WPP when threads are disabled
When WPP is enabled, a reference to SAO reconstruction job is copied
from the wavefront to the main encoder state. However, when threads are
disabled, the job is a null pointer and dereferencing it crashes the
encoder. Fixed by adding a null pointer check.
@@ -726,6 +726,8 @@ static void encoder_state_encode(encoder_state_t * const main_state) {
job = kvz_threadqueue_submit(main_state->encoder_control->threadqueue, encoder_state_worker_sao_reconstruct_lcu, data, 1, job_description);
+ // If job object was returned, add dependancies and allow it to run.
+ if (job) {
// This dependancy is needed, because the pre-SAO pixels from the LCU row
// below this one are read straigh from the frame.
if (previous_job) {
@@ -757,6 +759,7 @@ static void encoder_state_encode(encoder_state_t * const main_state) {
}
}
}
+ }
} else {
for (i=0; main_state->children[i].encoder_control; ++i) {
encoder_state_worker_encode_children(&(main_state->children[i]));
