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

WebRTC #7

Closed
HidenoriMatsubayashi opened this issue Jul 29, 2021 · 15 comments
Closed

WebRTC #7

HidenoriMatsubayashi opened this issue Jul 29, 2021 · 15 comments
Labels
enhancement New feature or request

Comments

@HidenoriMatsubayashi
Copy link
Collaborator

HidenoriMatsubayashi commented Jul 29, 2021

Create WebRTC plugin
https://github.com/flutter-webrtc/flutter-webrtc

@cloudwebrtc
Copy link

cloudwebrtc commented Nov 25, 2021

Hi @HidenoriMatsubayashi , I have tried some elinux plugins. It uses the CPP code of the flutter windows part without any modification, but it seems that cross-thread calls inside elinux will cause the flutter engine to crash. I don't have any ideas yet, I need to prepare an elinux debugging environment when I have time.

flutter-webrtc/flutter-webrtc#1338

@HidenoriMatsubayashi
Copy link
Collaborator Author

@cloudwebrtc

Great! I'm looking forward to be merged it to flutter-webrtc mainstream.

but it seems that cross-thread calls inside elinux will cause the flutter engine to crash. I don't have any ideas yet, I need to prepare an elinux debugging environment when I have time.

Could you try again with release mode?

@cloudwebrtc

This comment was marked as outdated.

@cloudwebrtc
Copy link

cloudwebrtc commented Aug 27, 2022

Update:
The crash just happens in debug mode, everything works fine in release/profile mode

In debug mode, it seems that the problem occurs with asserts caused by cross-thread calls

[FATAL:flutter/fml/memory/weak_ptr.h(111)] Check failed: (checker_.checker).IsCreationThreadCurrent().

@cloudwebrtc
Copy link

@HidenoriMatsubayashi I tested it on Ubuntu 22.04, it can run well on elinux wayland/x11 (profile/release), tested audio/video loopback sample, data-channel echo test.

@HidenoriMatsubayashi
Copy link
Collaborator Author

@cloudwebrtc Great!

[FATAL:flutter/fml/memory/weak_ptr.h(111)] Check failed: (checker_.checker).IsCreationThreadCurrent().

In debug mode, FML_DCHECK_CREATION_THREAD_IS_CURRENT is enabled in flutter/engine.
See: https://github.com/flutter/engine/blob/main/fml/memory/thread_checker.h

We should only send events like EventChannel from the main thread, I think.

@cloudwebrtc
Copy link

hey @HidenoriMatsubayashi, Is there any way to get the main thread from the plugin? Or any method can send a callback pointer to the task queue of the flutter engine.

@cloudwebrtc
Copy link

flutter linux gtk can work correctly in debug mode, but I don't know the difference between it and elinux in message scheduling.

@HidenoriMatsubayashi
Copy link
Collaborator Author

Let me investigate.

@talksik
Copy link
Contributor

talksik commented Jul 20, 2023

Hey there, thanks for the progress so far on this. I am a newbie in trying to understand eLinux.

  1. Would it be a big lift if I want to use flutter FFI calls to rust, which then uses gstreamer pipeline with appsrc element to get frames to dart? This is leaving WebRTC alone, and as I just need to get frames so that the dart code can send frames via network calls or do something else.

  2. What would be required to play those frames in flutter or incoming frames from udp connection? I want to believe I can make a UDP connection at the dart layer, and pass those frames to rust via FFI, and finally rust uses Gstreamer and sends those frames to what? Skia?

  3. Would you instead recommend me to use QT (since QT excels at embedded & multi-media apps) instead of dealing with flutter since flutter is early in the embedded scene?

Would really appreciate some basic beginner explanation to all of this or some resources! Thank you so much!

@talksik
Copy link
Contributor

talksik commented Jul 24, 2023

I found out more about the above after a load of research. I understand that the best and pretty much only way to render frames from incoming bytes is doing it at the native level. This is C++ for flutter apps in linux.

You create textures from decoded frames and then register these textures with the registrar which is something that flutter provides and seems to be straightforward.

I will be attempting a custom plugin which does basic streaming abilities. Our use case requires something more custom and lightweight than webRTC, so I will keep you all updated. Thanks for the code sample with the current open branch you have @cloudwebrtc !

@HidenoriMatsubayashi HidenoriMatsubayashi added the enhancement New feature or request label Aug 31, 2023
@Kofhein
Copy link

Kofhein commented Sep 5, 2024

Hello, @cloudwebrtc @HidenoriMatsubayashi I opened this issue sony/flutter-embedded-linux#421 with solution that resolves issue with debug mode of flutter-elinux, main problem that messages from native side is not being sent on main thread, so they need to be marshalled there.

@HidenoriMatsubayashi
Copy link
Collaborator Author

Hi @cloudwebrtc

Thanks to @Kofhein, now https://github.com/flutter-webrtc/flutter-webrtc/tree/feat/support-elinux2 works fine with the latest flutter-elinux (version 3.24.3). Could you please check this? Thanks.

@cloudwebrtc
Copy link

cloudwebrtc commented Sep 13, 2024

Cool !!!, let me take a look and merge it.

done!

@HidenoriMatsubayashi
Copy link
Collaborator Author

Great! I've added the link of flutter-webrtc to readme.
https://github.com/sony/flutter-elinux-plugins?tab=readme-ov-file#plugins

(sorry for the late reply, I had missed your message.)

Closing.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants