Commit 190fdc9
committed
fix(recording): stop the WGC helper from hanging on stop with no audio/webcam/cursor
The final "wait for stop" in wgc-capture's main() shared the same mutex/cv
as the video-writer thread's per-frame encode loop. That loop holds the
mutex for the full duration of each frame's GPU copy + software encode
call, so if the encode pipeline stalls (slow software encoder, flaky GPU
driver), the main thread can't even acquire the lock to check whether
`stop` was requested -- turning a stall into a silent, unbounded hang with
no [stop-timing] diagnostic output at all (issue #115). This reproduces
specifically when audio/mic/webcam/cursor are all disabled because in that
configuration nothing else is left holding/releasing that mutex on a
faster cadence to give the stop check a chance to run.
Give CaptureControl a dedicated stopMutex/stopCv used only to signal "stop
was requested", decoupled from the frame-processing mutex. The stdin
reader thread now notifies both cvs on stop, and the final stop-wait uses
only the dedicated pair, so stop detection never depends on the frame
pump releasing its lock.
Fixes #1151 parent d5966ed commit 190fdc9
1 file changed
Lines changed: 25 additions & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
57 | 57 | | |
58 | 58 | | |
59 | 59 | | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
60 | 73 | | |
61 | 74 | | |
62 | 75 | | |
| |||
359 | 372 | | |
360 | 373 | | |
361 | 374 | | |
| 375 | + | |
362 | 376 | | |
363 | 377 | | |
364 | 378 | | |
| |||
378 | 392 | | |
379 | 393 | | |
380 | 394 | | |
| 395 | + | |
381 | 396 | | |
382 | 397 | | |
383 | 398 | | |
| |||
586 | 601 | | |
587 | 602 | | |
588 | 603 | | |
| 604 | + | |
589 | 605 | | |
590 | 606 | | |
591 | 607 | | |
| |||
657 | 673 | | |
658 | 674 | | |
659 | 675 | | |
| 676 | + | |
660 | 677 | | |
661 | 678 | | |
662 | 679 | | |
| |||
669 | 686 | | |
670 | 687 | | |
671 | 688 | | |
| 689 | + | |
672 | 690 | | |
673 | 691 | | |
674 | 692 | | |
| |||
711 | 729 | | |
712 | 730 | | |
713 | 731 | | |
| 732 | + | |
714 | 733 | | |
715 | 734 | | |
716 | 735 | | |
| |||
840 | 859 | | |
841 | 860 | | |
842 | 861 | | |
843 | | - | |
844 | | - | |
| 862 | + | |
| 863 | + | |
| 864 | + | |
| 865 | + | |
| 866 | + | |
| 867 | + | |
845 | 868 | | |
846 | 869 | | |
847 | 870 | | |
| |||
0 commit comments