Commit 0e9e64a
committed
fix(tts): wrap AudioFileClip.duration in try/finally for elevenlabs, chatterbox, and fish_audio
In a long-running FastAPI server process, MoviePy's AudioFileClip spawns
an FFmpeg subprocess. If anything raises between AudioFileClip() and
.close() the subprocess is leaked. The three providers affected
(elevenlabs_tts, chatterbox_tts, fish_audio_tts) all used the bare
sequential pattern; the pre-existing _write_validated_minimax_audio
already wraps .duration in try/finally. This commit makes all four
sites consistent.
Add three unit tests that confirm .close() is called even when reading
.duration raises a RuntimeError.1 parent 465b8b3 commit 0e9e64a
2 files changed
Lines changed: 115 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1686 | 1686 | | |
1687 | 1687 | | |
1688 | 1688 | | |
1689 | | - | |
1690 | | - | |
| 1689 | + | |
| 1690 | + | |
| 1691 | + | |
| 1692 | + | |
1691 | 1693 | | |
1692 | 1694 | | |
1693 | 1695 | | |
| |||
1773 | 1775 | | |
1774 | 1776 | | |
1775 | 1777 | | |
1776 | | - | |
1777 | | - | |
| 1778 | + | |
| 1779 | + | |
| 1780 | + | |
| 1781 | + | |
1778 | 1782 | | |
1779 | 1783 | | |
1780 | 1784 | | |
| |||
1915 | 1919 | | |
1916 | 1920 | | |
1917 | 1921 | | |
1918 | | - | |
1919 | | - | |
| 1922 | + | |
| 1923 | + | |
| 1924 | + | |
| 1925 | + | |
1920 | 1926 | | |
1921 | 1927 | | |
1922 | 1928 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
953 | 953 | | |
954 | 954 | | |
955 | 955 | | |
| 956 | + | |
| 957 | + | |
| 958 | + | |
| 959 | + | |
| 960 | + | |
| 961 | + | |
| 962 | + | |
| 963 | + | |
| 964 | + | |
| 965 | + | |
| 966 | + | |
| 967 | + | |
| 968 | + | |
| 969 | + | |
| 970 | + | |
| 971 | + | |
| 972 | + | |
| 973 | + | |
| 974 | + | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
| 991 | + | |
| 992 | + | |
| 993 | + | |
| 994 | + | |
| 995 | + | |
| 996 | + | |
| 997 | + | |
| 998 | + | |
| 999 | + | |
| 1000 | + | |
| 1001 | + | |
| 1002 | + | |
| 1003 | + | |
| 1004 | + | |
| 1005 | + | |
| 1006 | + | |
| 1007 | + | |
| 1008 | + | |
| 1009 | + | |
| 1010 | + | |
| 1011 | + | |
| 1012 | + | |
| 1013 | + | |
| 1014 | + | |
| 1015 | + | |
| 1016 | + | |
| 1017 | + | |
| 1018 | + | |
| 1019 | + | |
| 1020 | + | |
| 1021 | + | |
| 1022 | + | |
| 1023 | + | |
| 1024 | + | |
| 1025 | + | |
| 1026 | + | |
| 1027 | + | |
| 1028 | + | |
| 1029 | + | |
| 1030 | + | |
| 1031 | + | |
| 1032 | + | |
| 1033 | + | |
| 1034 | + | |
| 1035 | + | |
| 1036 | + | |
| 1037 | + | |
| 1038 | + | |
| 1039 | + | |
| 1040 | + | |
| 1041 | + | |
| 1042 | + | |
| 1043 | + | |
| 1044 | + | |
| 1045 | + | |
| 1046 | + | |
| 1047 | + | |
| 1048 | + | |
| 1049 | + | |
| 1050 | + | |
| 1051 | + | |
| 1052 | + | |
| 1053 | + | |
| 1054 | + | |
| 1055 | + | |
| 1056 | + | |
| 1057 | + | |
| 1058 | + | |
956 | 1059 | | |
957 | 1060 | | |
958 | 1061 | | |
| |||
0 commit comments