Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update to audioplayers v5 #345

Merged
merged 3 commits into from
Jan 15, 2024
Merged

Update to audioplayers v5 #345

merged 3 commits into from
Jan 15, 2024

Conversation

DoumanAsh
Copy link
Contributor

@DoumanAsh DoumanAsh commented Jul 6, 2023

Fixes #344

Test code

void main() {
  WidgetsFlutterBinding.ensureInitialized();
  test();
  runApp(const MyApp());
}

Future<void> test_dispose_player() async {
    final sound = AssetSource("sounds/bill_detected.mp3");
    final player = AudioPlayer();

    await player.play(sound);
    await player.setVolume(0.5);
    await player.setBalance(0.5);
    await player.release();

    await player.play(sound);
    await Future.delayed(const Duration(seconds: 1));

    await player.dispose();
}

void test() async {
    print("Run test");
    await test_dispose_player();

    final sound = AssetSource("sounds/bill_detected.mp3");
    final player = AudioPlayer();

    print("Prepare event listner");
    player.eventStream.listen((event) async {
        print("event=" + event.eventType.toString());
        if (event.eventType == AudioEventType.seekComplete) {
            await player.play(sound);
        }
    });

    print("Play");
    await player.play(sound);
}

@DoumanAsh DoumanAsh force-pushed the audioplayers_v4 branch 8 times, most recently from a9ba36d to 7006833 Compare July 7, 2023 14:14
@DoumanAsh DoumanAsh force-pushed the audioplayers_v4 branch 12 times, most recently from f89d61b to da604ff Compare July 8, 2023 09:44
@DoumanAsh DoumanAsh force-pushed the audioplayers_v4 branch 9 times, most recently from 7736429 to 21d902a Compare July 17, 2023 04:00
@DoumanAsh
Copy link
Contributor Author

@ardera I tested various functions of audioplayers with sanitizers enabled to make sure there is no UB in new code. PR is good to go

@DoumanAsh DoumanAsh marked this pull request as ready for review July 17, 2023 04:01
README.md Outdated Show resolved Hide resolved
README.md Outdated Show resolved Hide resolved
@ardera
Copy link
Owner

ardera commented Sep 22, 2023

Hey, sorry for the delay. In the meantime i pushed a big update to flutter-pi and lot of internal stuff changed (I also changed some small things in the audioplayers plugin in that update.) Can you rebase on top of master?

Notably:

  • includes of project files should use #include "..." now (instead of <...>)
  • removed pset and cpset, use a linked list instead (that's what I changed in the audioplayers plugin)
  • use streq instead of strcmp(a, b) == 0

@DoumanAsh
Copy link
Contributor Author

DoumanAsh commented Sep 22, 2023

Hm I rebased, but for some reason now I cannot link flutter-pi
I didn't follow changes but did you change dependencies maybe?
In any case I will check it tomorrow, but it should compile at least.
Need to be retested with new version

[ 97%] Linking C executable flutter-pi
/usr/bin/aarch64-linux-gnu-ld: cannot find -ldrm
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgbm
/usr/bin/aarch64-linux-gnu-ld: cannot find -lsystemd
/usr/bin/aarch64-linux-gnu-ld: cannot find -linput
/usr/bin/aarch64-linux-gnu-ld: cannot find -lxkbcommon
/usr/bin/aarch64-linux-gnu-ld: cannot find -ludev
/usr/bin/aarch64-linux-gnu-ld: cannot find -lEGL
/usr/bin/aarch64-linux-gnu-ld: cannot find -lGLESv2
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgstallocators-1.0
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgstvideo-1.0
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgstaudio-1.0
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgstbase-1.0
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgstreamer-1.0
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgobject-2.0
/usr/bin/aarch64-linux-gnu-ld: cannot find -lglib-2.0

@ardera
Copy link
Owner

ardera commented Sep 22, 2023

Hm I rebased, but for some reason now I cannot link flutter-pi I didn't follow changes but did you change dependencies maybe? In any case I will check it tomorrow, but it should compile at least. Need to be retested with new version

[ 97%] Linking C executable flutter-pi
/usr/bin/aarch64-linux-gnu-ld: cannot find -ldrm
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgbm
/usr/bin/aarch64-linux-gnu-ld: cannot find -lsystemd
/usr/bin/aarch64-linux-gnu-ld: cannot find -linput
/usr/bin/aarch64-linux-gnu-ld: cannot find -lxkbcommon
/usr/bin/aarch64-linux-gnu-ld: cannot find -ludev
/usr/bin/aarch64-linux-gnu-ld: cannot find -lEGL
/usr/bin/aarch64-linux-gnu-ld: cannot find -lGLESv2
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgstallocators-1.0
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgstvideo-1.0
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgstaudio-1.0
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgstbase-1.0
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgstreamer-1.0
/usr/bin/aarch64-linux-gnu-ld: cannot find -lgobject-2.0
/usr/bin/aarch64-linux-gnu-ld: cannot find -lglib-2.0

Didn't change anything in that regard, idk maybe delete the build folder and try again?

@DoumanAsh
Copy link
Contributor Author

Ok, I will try to figure out
It is been a while since I used flutter-pi so maybe my build env broken now

@DoumanAsh DoumanAsh force-pushed the audioplayers_v4 branch 3 times, most recently from cba017c to 59000aa Compare October 22, 2023 15:40
@DoumanAsh
Copy link
Contributor Author

@ardera btw on current master there seem to be small ASAN issue:

Direct leak of 31 byte(s) in 1 object(s) allocated from:
    #0 0x556ec1286c in __interceptor_malloc (/usr/local/bin/flutter-pi+0xd286c)
    #1 0x7f9f33abf4 in __vasprintf_internal libio/vasprintf.c:71
    #2 0x7f9f33acb8 in __vasprintf libio/vasprintf.c:90
    #3 0x556ebd9f18 in vasprintf (/usr/local/bin/flutter-pi+0x99f18)
    #4 0x556ebda2a0 in asprintf (/usr/local/bin/flutter-pi+0x9a2a0)
    #5 0x556eca66e8 in fs_layout_flutterpi_resolve /home/douman/flutter-pi/src/filesystem_layout.c:255
    #6 0x556ec57900 in setup_paths /home/douman/flutter-pi/src/flutter-pi.c:1871
    #7 0x556ec5aa60 in flutterpi_new_from_args /home/douman/flutter-pi/src/flutter-pi.c:2314
    #8 0x556ec5d294 in flutterpi_app_main /home/douman/flutter-pi/src/flutter-pi.c:2762
    #9 0x556ec4ecdc in main /home/douman/flutter-pi/src/main.c:4
    #10 0x7f9f2eee14 in __libc_start_main ../csu/libc-start.c:308
    #11 0x556eb99374  (/usr/local/bin/flutter-pi+0x59374)

@DoumanAsh
Copy link
Contributor Author

DoumanAsh commented Oct 22, 2023

I updated code base to, as far as I can see, latest version 5.*.* but unfortunately I currently cannot make it work yet.
I need to figure out what is missing before this can be merged

@ardera if you remember, was there any changes/bug fixes related to platform channels?

@DoumanAsh DoumanAsh changed the title Update to audioplayers v4 Update to audioplayers v5 Oct 22, 2023
Emit error if set source fails to set ready state
Implement new release method
Return NULL in align with audioplayers API
Fix playbin identification in on media state change
@DoumanAsh
Copy link
Contributor Author

DoumanAsh commented Oct 28, 2023

@ardera Audio works again, please review when you have time. I will go over ASAN issues in codebase meanwhile
No ASAN issues found with code

@ardera ardera merged commit 692cec2 into ardera:master Jan 15, 2024
49 checks passed
@DoumanAsh DoumanAsh deleted the audioplayers_v4 branch January 16, 2024 02:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Check audio plugin against audioplayers v4
2 participants