Commit f1b55c6
committed
fix(encoder): stop async worker before codec access in Reset()
VideoEncoder::Reset() was accessing codec_context_ for FFmpeg flush
operations before stopping the async worker thread. The worker could
still be calling avcodec_send_frame() concurrently, causing SIGSEGV
since AVCodecContext is not thread-safe.
Fix: Stop async worker and release TSFNs first, then flush codec.
This matches the safe pattern already used in VideoDecoder::Reset().
Also adds defensive null check for packet_ during flush.1 parent 64b0daa commit f1b55c6
1 file changed
Lines changed: 23 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
887 | 887 | | |
888 | 888 | | |
889 | 889 | | |
890 | | - | |
891 | | - | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
| 894 | + | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
| 898 | + | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
| 903 | + | |
| 904 | + | |
| 905 | + | |
| 906 | + | |
| 907 | + | |
892 | 908 | | |
893 | 909 | | |
894 | 910 | | |
895 | 911 | | |
896 | 912 | | |
897 | 913 | | |
898 | 914 | | |
899 | | - | |
| 915 | + | |
| 916 | + | |
| 917 | + | |
| 918 | + | |
| 919 | + | |
900 | 920 | | |
901 | 921 | | |
902 | 922 | | |
| |||
0 commit comments