The problem of playing multi-audio with FFmpeg + SDL

requirements:
play two audio files at the same time (duration: one long and one short). Playback requirements:
as shown in the figure:

  1. Audio file 1 plays normally, and the total length of the file is greater than the set playback duration
  2. Audio file 2. The total length of the file is less than the set playback duration

problem:
the total duration of audio file 2 is less than the set playback time. When audio 2 playback ends, audio file 1 becomes muted.

Code:

the code part hasn"t been sorted out yet
The

code has not been sorted out for the time being. I wonder if there are any partners who have encountered the same problem. How do you play multiple audio at the same time and can perfectly solve the problems encountered above?

Mar.10,2021
Menu