A little confusion in playing audio by SDL2

when I see ideaudioexamples.html" rel=" nofollow noreferrer "> Audio Example in SDL2, I have some doubts about some of the code. The code is as follows:

// sdl_audio_example.c

-sharpdefine MAX_AUDIO_FRAME_SIZE 192000

// TODO: 1. 
// TODO: 2. audio_chunkaudio_pos = out_buffer??
static Uint8 *audio_chunk;
static Uint32 audio_len;
static Uint8 *audio_pos;

void audio_callback(void *udata, Uint8 *stream, int len)
{
    if ( audio_len == 0 )
        return;

    len = ( len > audio_len ? audio_len : len );
    SDL_MixAudio(stream, audio_pos, len, SDL_MIX_MAXVOLUME);
    
    audio_pos += len;
    audio_len -= len;
}

int main(int argc, char *argv[]){
    // do something ...
    
    uint8_t *out_buffer = (uint8_t *)av_malloc(MAX_AUDIO_FRAME_SIZE * 3 / 2);
    int out_buffer_size = av_samples_get_buffer_size(NULL, nb_channels, nb_samples, AV_SAMPLE_FMT_S16, 1);
    
    for(;;){
        AVFrame *frame = ...;
        
        swr_convert(swr_ctx,
                    &out_buffer,
                    MAX_AUDIO_FRAME_SIZE,
                    (const uint_8 *)frame->data[0],
                    frame->nb_samples);
                    
        audio_chunk = (uint8_t *)out_buffer;
        audio_len = out_buffer_size;
        audio_pos = audio_chunk;
    }

    return 0;
}

question
as shown in the code above:

  1. the meanings represented by the three variables audio_chunk, audio_len and audio_pos
  2. audio_pos says it"s a static buffer, and how does len update the location? Can you draw a picture and describe it?
  3. whether audio_chunk can be omitted, directly audio_pos=out_buffer??

Thank you very much!

Apr.14,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1be88ba-31916.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1be88ba-31916.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?