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
M120 #173
base: v3
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
wow
Would you be so kind to test this branch out within your app? I'm still fighting with the inability to run the tests, nor the demo we have (which relies on the libwebrtc test code). If you can confirm this is working we would release it. Thanks. |
Asking for help in order to make m120 work. This is the error I'm getting when enabling tests (-DMEDIASOUPCLIENT_BUILD_TESTS:BOOLEAN=ON): For some reason the resulting The gn args I'm using are: I've dived into the code and theoretically they should be present if A hand here would be appreciated. CC-ing those who commented on the m112 upgrade PR: |
@jmillan, sure! I am happy to help! One question though: is this issue present on all OSes or still specific to MacOS? |
Thanks! I'm experiencing it myself in MacOS concretely. Not sure if it will repro in other OS. |
@jmillan, alright. I'll check it tomorrow on Windows and MacOS both and report back. |
I want to help! Will try to have a look in the weekend, can't promise anything though! |
I can't even seem to be able to build libwebrtc m120 on Ubuntu 22.04:
😕 |
According to docs:
Include mismatch? |
@copiltembel your idea looks valid considering these comments in BUILD.gn # Heavy but optional helper for unittests and webrtc users who prefer to use
# defaults factories or do not worry about extra dependencies and binary size.
rtc_library("rtc_media_engine_defaults") {
... |
OK, so my previous comment was not correct, the missing symbols are in differents libs: Linking
stops it from complaining about the missing enc and dec factories. |
Next missing symbols webrtc::SimulcastEncoderAdapter::SimulcastEncoderAdapter(webrtc::VideoEncoderFactory*, webrtc::SdpVideoFormat const&)
webrtc::InternalDecoderFactory
webrtc::InternalEncoderFactory are fixed by linking this libs: ${LIBWEBRTC_BINARY_PATH}/media/librtc_simulcast_encoder_adapter${CMAKE_STATIC_LIBRARY_SUFFIX}
${LIBWEBRTC_BINARY_PATH}/media/librtc_internal_video_codecs${CMAKE_STATIC_LIBRARY_SUFFIX} And this one is also missing: webrtc::webrtc_sequence_checker_internal::SequenceCheckerImpl::ExpectationToString() but it is not even compiled in normal (release) WebRTC builds. On source-code level it is implemented under preprocessor condition After that, tests are built without errors (on my machine, as we used to say 🤣). However, they are not green:
|
(On Ubuntu 22.04) Re libwebrtc m120, I'm a bit lost because:
This is the only thing that works:
But then when linking it against test_mediasoupclient, I get alot of errors like these:
|
@copiltembel this part abi:cxx11 looks suspicious in your logs. We should use same language version for building all components. Both WebRTC and libmediasoupclient switched C++ 17 for current versions. |
Got it, but it's not like I'm doing it on purpose. I'm just checking out libwebrtc and libmediasoupclient and trying to build them. Not changing anything. |
These errors come from calling Meaning those methods are called by the test process but now libwebrtc expects it to come from the provided signaling thread... |
Email posted to discuss-webrtc https://groups.google.com/g/discuss-webrtc/c/q0srUpz1rbQ |
This is very probably only affecting the tests since we are using these internal encoder/decoder factories etc. Can anyone please try this version within you own app? |
I'm having a look at mediasoup-broadcaster-demo. I think it would be useful to have that build and run before moving forward. Here's the updates that I made so far: https://github.com/copiltembel/mediasoup-broadcaster-demo/tree/m120 Unfortunately I have the same issue as above at link time. |
Broadcaster demo uses the same internal encoder/decoders as the tests.., this is why it's not helpful. This is why I asked that anyone who has an app based on libmediasoupclient to test this branch, since such app will get the tracks from a device or file and not from libwebrtc sources. |
Got it.
I have such an app, but as said before, I cannot build it using this branch. I guess because I can only build
|
iOS app I'm working on has switched to WerRTC m120 and libmediasoupclient 3.4.1. This version is in public for three weeks now and I don't see any anomalies in Crashlytics reports since then. I've already merged newer libmediasoupclient changes but can't say when it will roll to production yet. Our Android team has also adopted WebRTC m120 and libmediasoupclient 3.4.1. They've faced assertion failures when WebRTC is built in debug mode when stopping a producer. Looked like calling something on a wrong thread. On release build it works stable though, but it's still in QA and not verified by real-world users yet. |
After some libwebrtc code torturing, I was able to build, run and ... crash (my own app). Here is the call stack: (on
webrtc/src/api/sequence_checker.h
The weird thing is:
Tried a bit with libwebrtc in debug mode, I get crashes when initializing the audio device module:
|
The method calls of the track should hop on over to the signaling thread when invoking on a proxy object, which is what you should have, rather than having a direct pointer to the underlaying track object. So something has changed lately in the way a track is obtained that we (including in libmediasoupclient tests) are not getting the track within the corresponding proxy. That is why the thread check does not succeed. |
Unfortunately I see there's no help coming from the discuss-webrtc forum. |
I got a private message (?) telling exactly what I said here. |
Maybe I am misunderstanding something, but the crash I am seeing (with libwebrtc in release) is on the |
Maybe the crash is in the signaling thread as a result of calling a method on an object using another thread. When in that scenario it's hard to anticipate how the whole app will crash. Imagine that the non-signaling thread (without any thread lock mechanism in place) changes some memory that the signaling thread is reading or writing to. Then the crash will indeed happen in the signaling thread. |
I had an issue when building in debug, I wasn't using the workerThread to create the audioDeviceModule. With But running with
As @ibc said, there might be some concurrency issue, which occurs more often in release mode than in debug. Seems difficult to identify and fix. |
is there a plan to merge this into v3 anytime soon? |
As you can see in comments above yours there are unresolved items before this PR can be merged. You are welcome to help with them. |
Hi! I have promised to look into the issues and didn't help at all! And for that I am sorry - life got in a way. From what I can see in this thread and from what I've observed on my local machine, the issue here lies in the threads. LibWebRTC is very particular on how objects are created, used and destroyed. In order to enforce correct usage of these resources, they have all these For example, for the test case On the screenshot below, you can see call stack for the current thread and its name. The thread name is indeed This doesn't make any sense, so let's patch LibWebRTC and add variable to store current thread. This way, we will be able to use debugger to inspect all variables. We will use this to compare current thread variable and class local thread variable. And what do we get? This is not the same thread at all! They share the same thread name yes, these are different objects. So, how did we get into this situation? Well, the reason is how tests are structured. In the test case
And so, with every test case ran, we indirectly create more and more factory interfaces and threads for it until LibWebRTC blows up somewhere. Bonus picture showing amount of threads created up until |
this->workerThread.get(), | ||
// TMP: Use the same thread for signaling and worker. | ||
// this->workerThread.get(), | ||
this->signalingThread.get(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I also want to note that this looks extremely sketchy. If LibWebRTC truly wanted you to use signaling thread as both worker and signaling, they'd do so in other ways (such as taking only 2 pointers).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, this is a temporal work around that needs to be removed.
I also tested this on Windows/MSVC and to build mediasoupclient tests I had to patch LibWebRTC with the following patch. It is taken from LibWebRTC Gerrit. diff --git a/build/config/win/BUILD.gn b/build/config/win/BUILD.gn
index 59caa7b42..7518fff68 100644
--- a/build/config/win/BUILD.gn
+++ b/build/config/win/BUILD.gn
@@ -41,6 +41,10 @@ declare_args() {
# and with this switch, clang emits it like this:
# foo/bar.cc:12:34: error: something went wrong
use_clang_diagnostics_format = false
+
+ # Force dynamic crt build. Setting to true compiles targets using dynamic_crt (/MD).
+ # When false, default_crt will be used.
+ use_dynamic_crt = false
}
# This is included by reference in the //build/config/compiler config that
@@ -472,7 +476,7 @@ config("default_crt") {
# exceptions on.
configs = [ ":dynamic_crt" ]
} else {
- if (current_os == "winuwp") {
+ if (current_os == "winuwp" || use_dynamic_crt) {
# https://blogs.msdn.microsoft.com/vcblog/2014/06/10/the-great-c-runtime-crt-refactoring/
# contains a details explanation of what is happening with the Windows
# CRT in Visual Studio releases related to Windows store applications. During GN run you'd also need to pass After that, linking would fail because no Windows system libraries where provided. I had to add following patch to target_link_libraries(test_mediasoupclient PRIVATE
Secur32
Winmm
wmcodecdspuuid
Msdmo
dmoguids
Iphlpapi
) |
Thanks @Poldraunic! I'll create a proper Factory class to avoid that and try. |
@jmillan, let me know if you need help! |
No description provided.