There is a very small probability that the ReadThread will always wait for run_event signal after filet_Stop calls qcap_driver_stop_stream, and then filter_Stop is stuck waiting for the ReadThread to exit when calling qcap_driver_cleanup_stream. This issue was found in the video call hang up of Tencent QQ application.
Signed-off-by: Jiajin Cui cuijiajin@uniontech.com --- dlls/qcap/v4l.c | 1 + 1 file changed, 1 insertion(+)
On 6/28/20 1:07 AM, Jiajin Cui wrote:
There is a very small probability that the ReadThread will always wait for run_event signal after filet_Stop calls qcap_driver_stop_stream, and then filter_Stop is stuck waiting for the ReadThread to exit when calling qcap_driver_cleanup_stream. This issue was found in the video call hang up of Tencent QQ application.
Signed-off-by: Jiajin Cui cuijiajin@uniontech.com
dlls/qcap/v4l.c | 1 + 1 file changed, 1 insertion(+)
While this certainly works, I don't particularly like the code organization (it's kind of existentially weird that cleanup_stream() sets "run_event".) After playing with this for a while I came up with a different solution that uses a condition variable, and should also fix this hang. I've sent that to the mailing list; please let me know whether it fixes your problem.
Hello Zebediah, I read your modifications and tested accordingly, and found that there was a small problem: After ReadThead() called EnterCriticalSection(), it caused other threads to wait for the critical section object when calling v4l_device_start_stream()/v4l_device_stop_stream()/v4l_device_cleanup_stream() function. You can use graphedit.exe to test. When the fiter is connected, the program will freeze after clicking the play/pause/stop button. I think need to modify the positionof that calls EnterCriticalSection () and LeaveCriticalSection() in the ReadThread () function. what do you think?
On 6/28/20 1:07 AM, Jiajin Cui wrote:
There is a very small probability that the ReadThread will always wait for run_event signal after filet_Stop calls qcap_driver_stop_stream, and then filter_Stop is stuck waiting for the ReadThread to exit when calling qcap_driver_cleanup_stream. This issue was found in the video call hang up of Tencent QQ application.
Signed-off-by: Jiajin Cui cuijiajin@uniontech.com
dlls/qcap/v4l.c | 1 + 1 file changed, 1 insertion(+)
While this certainly works, I don't particularly like the code organization (it's kind of existentially weird that cleanup_stream() sets "run_event".) After playing with this for a while I came up with a different solution that uses a condition variable, and should also fix this hang. I've sent that to the mailing list; please let me know whether it fixes your problem.
Hello Zebediah, I read your modifications and tested accordingly, and found that there was a small problem: After ReadThead() called EnterCriticalSection(), it caused other threads to wait for the critical section object when calling v4l_device_start_stream()/v4l_device_stop_stream()/v4l_device_cleanup_stream() function. You can use graphedit.exe to test. When the fiter is connected, the program will freeze after clicking the play/pause/stop button. I think need to modify the positionof that calls EnterCriticalSection () and LeaveCriticalSection() in the ReadThread () function. what do you think?
On 6/28/20 1:07 AM, Jiajin Cui wrote:
There is a very small probability that the ReadThread will always wait for run_event signal after filet_Stop calls qcap_driver_stop_stream, and then filter_Stop is stuck waiting for the ReadThread to exit when calling qcap_driver_cleanup_stream. This issue was found in the video call hang up of Tencent QQ application.
Signed-off-by: Jiajin Cui cuijiajin@uniontech.com
dlls/qcap/v4l.c | 1 + 1 file changed, 1 insertion(+)
While this certainly works, I don't particularly like the code organization (it's kind of existentially weird that cleanup_stream() sets "run_event".) After playing with this for a while I came up with a different solution that uses a condition variable, and should also fix this hang. I've sent that to the mailing list; please let me know whether it fixes your problem.
On 6/29/20 1:31 AM, Jiajin Cui wrote:
Hello Zebediah, I read your modifications and tested accordingly, and found that there was a small problem: After ReadThead() called EnterCriticalSection(), it caused other threads to wait for the critical section object when calling v4l_device_start_stream()/v4l_device_stop_stream()/v4l_device_cleanup_stream() function. You can use graphedit.exe to test. When the fiter is connected, the program will freeze after clicking the play/pause/stop button. I think need to modify the positionof that calls EnterCriticalSection () and LeaveCriticalSection() in the ReadThread () function. what do you think?
Thanks, I've sent a new version that should fix that deadlock.
On 6/28/20 1:07 AM, Jiajin Cui wrote:
There is a very small probability that the ReadThread will always wait for run_event signal after filet_Stop calls qcap_driver_stop_stream, and then filter_Stop is stuck waiting for the ReadThread to exit when calling qcap_driver_cleanup_stream. This issue was found in the video call hang up of Tencent QQ application.
Signed-off-by: Jiajin Cui cuijiajin@uniontech.com
dlls/qcap/v4l.c | 1 + 1 file changed, 1 insertion(+)
While this certainly works, I don't particularly like the code organization (it's kind of existentially weird that cleanup_stream() sets "run_event".) After playing with this for a while I came up with a different solution that uses a condition variable, and should also fix this hang. I've sent that to the mailing list; please let me know whether it fixes your problem.