Close the audio codec
| 929 | |
| 930 | // Close the audio codec |
| 931 | void FFmpegWriter::close_audio(AVFormatContext *oc, AVStream *st) |
| 932 | { |
| 933 | // Clear buffers |
| 934 | delete[] samples; |
| 935 | delete[] audio_outbuf; |
| 936 | delete[] audio_encoder_buffer; |
| 937 | samples = NULL; |
| 938 | audio_outbuf = NULL; |
| 939 | audio_encoder_buffer = NULL; |
| 940 | |
| 941 | // Deallocate resample buffer |
| 942 | if (avr) { |
| 943 | SWR_CLOSE(avr); |
| 944 | SWR_FREE(&avr); |
| 945 | avr = NULL; |
| 946 | } |
| 947 | |
| 948 | if (avr_planar) { |
| 949 | SWR_CLOSE(avr_planar); |
| 950 | SWR_FREE(&avr_planar); |
| 951 | avr_planar = NULL; |
| 952 | } |
| 953 | |
| 954 | // Free any previous memory allocations |
| 955 | if (audio_codec_ctx != nullptr) { |
| 956 | AV_FREE_CONTEXT(audio_codec_ctx); |
| 957 | av_free(audio_codec_ctx); |
| 958 | } |
| 959 | } |
| 960 | |
| 961 | // Close the writer |
| 962 | void FFmpegWriter::Close() { |
nothing calls this directly
no outgoing calls
no test coverage detected