Fix rare hang in multi-thread encoder on Windows
This patch is to fix a rare hang in multi-thread encoder that was only seen on Windows. Thanks for John's help in debugging the problem. More test is needed. Change-Id: Idb11c6d344c2082362a032b34c5a602a1eea62fc
This commit is contained in:
@@ -514,6 +514,7 @@ void vp8cx_create_encoder_threads(VP8_COMP *cpi)
|
|||||||
LPFTHREAD_DATA * lpfthd = &cpi->lpf_thread_data;
|
LPFTHREAD_DATA * lpfthd = &cpi->lpf_thread_data;
|
||||||
|
|
||||||
sem_init(&cpi->h_event_start_lpf, 0, 0);
|
sem_init(&cpi->h_event_start_lpf, 0, 0);
|
||||||
|
sem_init(&cpi->h_event_end_picklpf, 0, 0);
|
||||||
sem_init(&cpi->h_event_end_lpf, 0, 0);
|
sem_init(&cpi->h_event_end_lpf, 0, 0);
|
||||||
|
|
||||||
lpfthd->ptr1 = (void *)cpi;
|
lpfthd->ptr1 = (void *)cpi;
|
||||||
@@ -547,6 +548,7 @@ void vp8cx_remove_encoder_threads(VP8_COMP *cpi)
|
|||||||
|
|
||||||
sem_destroy(&cpi->h_event_end_encoding);
|
sem_destroy(&cpi->h_event_end_encoding);
|
||||||
sem_destroy(&cpi->h_event_end_lpf);
|
sem_destroy(&cpi->h_event_end_lpf);
|
||||||
|
sem_destroy(&cpi->h_event_end_picklpf);
|
||||||
sem_destroy(&cpi->h_event_start_lpf);
|
sem_destroy(&cpi->h_event_start_lpf);
|
||||||
|
|
||||||
//free thread related resources
|
//free thread related resources
|
||||||
|
@@ -3140,7 +3140,7 @@ void loopfilter_frame(VP8_COMP *cpi, VP8_COMMON *cm)
|
|||||||
|
|
||||||
#if CONFIG_MULTITHREAD
|
#if CONFIG_MULTITHREAD
|
||||||
if (cpi->b_multi_threaded)
|
if (cpi->b_multi_threaded)
|
||||||
sem_post(&cpi->h_event_end_lpf); /* signal that we have set filter_level */
|
sem_post(&cpi->h_event_end_picklpf); /* signal that we have set filter_level */
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if (cm->filter_level > 0)
|
if (cm->filter_level > 0)
|
||||||
@@ -4135,7 +4135,7 @@ static void encode_frame_to_data_rate
|
|||||||
#if CONFIG_MULTITHREAD
|
#if CONFIG_MULTITHREAD
|
||||||
/* wait that filter_level is picked so that we can continue with stream packing */
|
/* wait that filter_level is picked so that we can continue with stream packing */
|
||||||
if (cpi->b_multi_threaded)
|
if (cpi->b_multi_threaded)
|
||||||
sem_wait(&cpi->h_event_end_lpf);
|
sem_wait(&cpi->h_event_end_picklpf);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// build the bitstream
|
// build the bitstream
|
||||||
|
@@ -590,6 +590,7 @@ typedef struct
|
|||||||
sem_t *h_event_start_encoding;
|
sem_t *h_event_start_encoding;
|
||||||
sem_t h_event_end_encoding;
|
sem_t h_event_end_encoding;
|
||||||
sem_t h_event_start_lpf;
|
sem_t h_event_start_lpf;
|
||||||
|
sem_t h_event_end_picklpf;
|
||||||
sem_t h_event_end_lpf;
|
sem_t h_event_end_lpf;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user