Basically, the code looks like this (you can file the whole source in the included Mediafire link)

```
int main(int argc, char *argv[])
{
    gf_sys_init(GF_MemTrackerSimple, NULL);
    gf_log_set_tool_level(GF_LOG_ALL, GF_LOG_INFO);
    FILE* logfile = gf_fopen("/home/rodolphe/api_compositor_no_mainthread.log", "wt");
    gf_log_set_callback(logfile, on_atscd_log);
    GF_FilterSession *fsess = gf_fs_new(0, GF_FS_SCHEDULER_LOCK_FREE, GF_FS_FLAG_NO_MAIN_THREAD, NULL);
//    loadSource("/home/rodolphe/test_30fps.mp4", fsess); works OK
    loadFilter("compositor:src=/home/rodolphe/test_30fps.mp4", fsess); // cracking sound

    loadFilter("vout", fsess);
    loadFilter("aout", fsess);

    while(!gf_fs_is_last_task(fsess)) {
        usleep(1000);
        gf_fs_run_step(fsess);
    }

    gf_fclose(logfile);
}
``` 

When executing this file but using the loadSource version, it works perfectly, the video is smooth, the audio plays perfectly.

When the loadSource is replaced by a compositor filter with the file as source, the audio cracks.


[Files for this issue:](https://www.mediafire.com/file/296rlgfjuvpq7zi/compositor_api.zip/file)
- the source file
- the video
- the log file when executing with the compositor as source

OS: Ubuntu 21.04
GPAC: compiled in debug - version 1.1.0-DEV-rev1283-gc51f07f11-master


---
Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

- [x] I looked for a similar issue and couldn't find any.
- [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95

Detailed guidelines: http://gpac.io/2013/07/16/how-to-file-a-bug-properly/

C Api - Audi cracking when running with compositor as source + no main thread
This is a GitHub Issue
repo:gpac
owner:gpac
Title : C Api - Audi cracking when running with compositor as source + no main thread
Issue date:

--- start body ---
Basically, the code looks like this (you can file the whole source in the included Mediafire link)

```
int main(int argc, char *argv[])
{
    gf_sys_init(GF_MemTrackerSimple, NULL);
    gf_log_set_tool_level(GF_LOG_ALL, GF_LOG_INFO);
    FILE* logfile = gf_fopen("/home/rodolphe/api_compositor_no_mainthread.log", "wt");
    gf_log_set_callback(logfile, on_atscd_log);
    GF_FilterSession *fsess = gf_fs_new(0, GF_FS_SCHEDULER_LOCK_FREE, GF_FS_FLAG_NO_MAIN_THREAD, NULL);
//    loadSource("/home/rodolphe/test_30fps.mp4", fsess); works OK
    loadFilter("compositor:src=/home/rodolphe/test_30fps.mp4", fsess); // cracking sound

    loadFilter("vout", fsess);
    loadFilter("aout", fsess);

    while(!gf_fs_is_last_task(fsess)) {
        usleep(1000);
        gf_fs_run_step(fsess);
    }

    gf_fclose(logfile);
}
``` 

When executing this file but using the loadSource version, it works perfectly, the video is smooth, the audio plays perfectly.

When the loadSource is replaced by a compositor filter with the file as source, the audio cracks.


[Files for this issue:](https://www.mediafire.com/file/296rlgfjuvpq7zi/compositor_api.zip/file)
- the source file
- the video
- the log file when executing with the compositor as source

OS: Ubuntu 21.04
GPAC: compiled in debug - version 1.1.0-DEV-rev1283-gc51f07f11-master


---
Thanks for reporting your issue. Please make sure these boxes are checked before submitting your issue - thank you!

- [x] I looked for a similar issue and couldn't find any.
- [x] I tried with the latest version of GPAC. Installers available at http://gpac.io/downloads/gpac-nightly-builds/
- [x] I give enough information for contributors to reproduce my issue (meaningful title, github labels, platform and compiler, command-line ...). I can share files anonymously with this dropbox: https://www.mediafire.com/filedrop/filedrop_hosted.php?drop=eec9e058a9486fe4e99c33021481d9e1826ca9dbc242a6cfaab0fe95da5e5d95

Detailed guidelines: http://gpac.io/2013/07/16/how-to-file-a-bug-properly/

--- end body ---
