Lime3DS/src/core/dumping
zhupengfei 4161163d9c
ffmpeg: Correctly handle sample rates
Previously, we just used the native sample rate for encoding. However, some encoders like libmp3lame doesn't support it. Therefore, we now use a supported sample rate (preferring the native one if possible).

FFmpeg requires audio data to be sent in a sequence of frames, each containing the same specific number of samples. Previously, we buffered input samples in FFmpegBackend. However, as the source and destination sample rates can now be different, we should buffer resampled data instead. swresample have an internal input buffer, so we now just forward all data to it and 'gradually' receive resampled data, at most one frame_size at a time. When there is not enough resampled data to form a frame, we will record the current offset and request for less data on the next call.

Additionally, this commit also fixes a flaw. When an encoder supports variable frame sizes, its frame size is reported to be 0, which breaks our buffering system. Now we treat variable frame size encoders as having a frame size of 160 (the size of a HLE audio frame).
2020-02-27 16:55:13 +08:00
..
backend.cpp video_core, core: Move pixel download to its own thread 2020-02-27 16:55:08 +08:00
backend.h core/dumping: Allow format/encoder selection+configuration 2020-02-27 16:55:10 +08:00
ffmpeg_backend.cpp ffmpeg: Correctly handle sample rates 2020-02-27 16:55:13 +08:00
ffmpeg_backend.h ffmpeg: Correctly handle sample rates 2020-02-27 16:55:13 +08:00