Has anyone ever actually compiled webrtc_unity_plugin.dll successfully?

489 views
Skip to first unread message

Ben Benjamin

unread,
Nov 20, 2017, 3:10:47 AM11/20/17
to discuss-webrtc
To those reading -- thanks for your time and all your great work. I'm stuck in a hole here: having fetched the latest, having `gn gen`'d the entire src directory, and finally having run `ninja -C out/Default` (all per these instructions), I've been unable to produce anything beyond the initial `webrtc_unity_plugin.ninja` file created by `gn gen`. My shell shows no errors. Some 3700+ tasks are run by the `ninja -C` command, and many files are created in `src/out/Default`, but nothing pertaining to webrtc_unity_plugin.

One thing I noticed inside of `src/out/Default/toolchain.ninja`, a block beginning at line 148:
```
build obj/examples/examples.stamp: stamp ./stun_prober.exe ./peerconnection_client.exe ./peerconnection_server.exe ./relayserver.exe ./stunserver.exe ./turnserver.exe
subninja obj/examples/peerconnection_client.ninja
subninja obj/examples/peerconnection_server.ninja
subninja obj/examples/relayserver.ninja
subninja obj/examples/stun_prober.ninja
subninja obj/examples/stunserver.ninja
subninja obj/examples/turnserver.ninja
subninja obj/examples/webrtc_unity_plugin.ninja
```

Note how the first line of the above block excludes any mention of `webrtc_unity_plugin`. In a misguided attempt to patch this I appended ` ./webrtc_unity_plugin.dll` to the end of this line and received a myriad of interesting but probably unrelated errors (happy to post them in this thread if anyone thinks they might be relevant).

Anyway, I'm desperate to implement the `SimplePeerConnectionM` namespace demonstrated in `src/examples/unityplugin/README` in a Unity app that communicates P2P with a standard web client via RTC. The methods implemented in the example plugin seem perfect, as they share so much with the browser javascript API, and every WebRTC plugin that currently exists for Unity offers little/zero documentation, rigid/unflexible signaling implementation, limited functionality, or all of the above. If ANYBODY has been able to implement the example webrtc_unity_plugin successfully, please let the world know how, I will be so extremely grateful!!

Alexandre GOUAILLARD

unread,
Nov 20, 2017, 6:54:09 AM11/20/17
to discuss...@googlegroups.com
on which platform did you try?
you need to be on windows or cross-compiling for android on linux.

also, it's a "testonly" target, so I don't think it's enable by default.

if (is_win || is_android) {
rtc_shared_library("webrtc_unity_plugin") {
testonly = true



--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/46efe0db-c4eb-45ab-92f6-773721c0d302%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Alex. Gouaillard, PhD, PhD, MBA
------------------------------------------------------------------------------------
President - CoSMo Software Consulting, Singapore
------------------------------------------------------------------------------------

Ben Benjamin

unread,
Nov 20, 2017, 12:49:15 PM11/20/17
to discuss-webrtc
I see! Is there a flag to throw in with `gn gen` that will compile targets marked `testonly`? When I run with `gn gen out/Default --testonly=true` it makes no difference. Using this documentation as my reference. For laughs, I tried setting `testonly = false` in `src/examples/BUILD.gn` and the gen command threw a predictable error because of the plugin's reliance on other testonly targets (specifically api:libjingle_peerconnection_test_api)

Platform is windows.


On Monday, November 20, 2017 at 3:54:09 AM UTC-8, Alexandre GOUAILLARD wrote:
on which platform did you try?
you need to be on windows or cross-compiling for android on linux.

also, it's a "testonly" target, so I don't think it's enable by default.

if (is_win || is_android) {
rtc_shared_library("webrtc_unity_plugin") {
testonly = true


On Mon, Nov 20, 2017 at 10:16 AM, Ben Benjamin <benmbe...@gmail.com> wrote:
To those reading -- thanks for your time and all your great work. I'm stuck in a hole here: having fetched the latest, having `gn gen`'d the entire src directory, and finally having run `ninja -C out/Default` (all per these instructions), I've been unable to produce anything beyond the initial `webrtc_unity_plugin.ninja` file created by `gn gen`. My shell shows no errors. Some 3700+ tasks are run by the `ninja -C` command, and many files are created in `src/out/Default`, but nothing pertaining to webrtc_unity_plugin.

One thing I noticed inside of `src/out/Default/toolchain.ninja`, a block beginning at line 148:
```
build obj/examples/examples.stamp: stamp ./stun_prober.exe ./peerconnection_client.exe ./peerconnection_server.exe ./relayserver.exe ./stunserver.exe ./turnserver.exe
subninja obj/examples/peerconnection_client.ninja
subninja obj/examples/peerconnection_server.ninja
subninja obj/examples/relayserver.ninja
subninja obj/examples/stun_prober.ninja
subninja obj/examples/stunserver.ninja
subninja obj/examples/turnserver.ninja
subninja obj/examples/webrtc_unity_plugin.ninja
```

Note how the first line of the above block excludes any mention of `webrtc_unity_plugin`. In a misguided attempt to patch this I appended ` ./webrtc_unity_plugin.dll` to the end of this line and received a myriad of interesting but probably unrelated errors (happy to post them in this thread if anyone thinks they might be relevant).

Anyway, I'm desperate to implement the `SimplePeerConnectionM` namespace demonstrated in `src/examples/unityplugin/README` in a Unity app that communicates P2P with a standard web client via RTC. The methods implemented in the example plugin seem perfect, as they share so much with the browser javascript API, and every WebRTC plugin that currently exists for Unity offers little/zero documentation, rigid/unflexible signaling implementation, limited functionality, or all of the above. If ANYBODY has been able to implement the example webrtc_unity_plugin successfully, please let the world know how, I will be so extremely grateful!!

--

---
You received this message because you are subscribed to the Google Groups "discuss-webrtc" group.
To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrt...@googlegroups.com.

Ben Benjamin

unread,
Nov 20, 2017, 7:27:55 PM11/20/17
to discuss-webrtc
Perhaps more relevant, I found this review of the webrtc source containing a comment of great interest to me:

"A functional Demo for Unity exists in a git repository that is outside of webrtc
code base. The demo is in C# and Unity specific stuff which cannot build in
webrtc code base."


Would anybody at the heart of webrtc be able to direct me to the demo referenced in this comment? Is there anywhere I can obtain the webrtc_unity_plugin.dll without self-compiling? If not, I'm happy to compile if we can determine why this build is being ignored by ninja!

Alexandre GOUAILLARD

unread,
Nov 26, 2017, 11:48:16 PM11/26/17
to discuss...@googlegroups.com
hi ben,

i finally had access to a windows computer.

The dll is not compiled by default.
you can get it by compiling it explicitly:

ninja -C out/Default webrtc_unity_plugin

the README illustrates how to use it in a C# unity code, with source code
the ANDROID file illustrates how to use it on android, with source code.

Hope this helps.




To unsubscribe from this group and stop receiving emails from it, send an email to discuss-webrtc+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/discuss-webrtc/513baafe-333b-4a8f-90d9-e28e357a204b%40googlegroups.com.

For more options, visit https://groups.google.com/d/optout.

Ben Benjamin

unread,
Nov 28, 2017, 1:11:51 PM11/28/17
to discuss-webrtc
Alexandre, thank you for your help! I'm still unfortunately failing to compile the dll - here's the output I get from running ninja -C out\Default webrtc_unity_plugin :

$ ninja -C out/Default webrtc_unity_plugin
ninja: Entering directory `out/Default'
[3/5] CXX obj/examples/webrtc_unity_plugin/simple_peer_connection.obj
FAILED: obj/examples/webrtc_unity_plugin/simple_peer_connection.obj
../../third_party/llvm-build/Release+Asserts/bin/clang-cl.exe /nologo /showIncludes  @obj/examples/webrtc_unity_plugin/simple_peer_connection.obj.rsp /c ../../examples/unityplugin/simple_peer_connection.cc /Foobj/examples/webrtc_unity_plugin/simple_peer_connection.obj /Fd"obj/examples/webrtc_unity_plugin_cc.pdb"
../../examples/unityplugin/simple_peer_connection.cc(92,33):  error: no matching function for call to 'CreatePeerConnectionFactory'
    g_peer_connection_factory = webrtc::CreatePeerConnectionFactory(
                                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
../..\api/peerconnectioninterface.h(1281,1):  note: candidate function not viable: requires 7 arguments, but 6 were provided
CreatePeerConnectionFactory(
^
../..\api/peerconnectioninterface.h(1219,52):  note: candidate function not viable: requires 8 arguments, but 6 were provided
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
                                                   ^
../..\api/peerconnectioninterface.h(1205,52):  note: candidate function not viable: requires 2 arguments, but 6 were provided
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
                                                   ^
../..\api/peerconnectioninterface.h(1235,52):  note: candidate function not viable: requires 10 arguments, but 6 were provided
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
                                                   ^
../..\api/peerconnectioninterface.h(1250,52):  note: candidate function not viable: requires 10 arguments, but 6 were provided
rtc::scoped_refptr<PeerConnectionFactoryInterface> CreatePeerConnectionFactory(
                                                   ^
1 error generated.
[4/5] CXX obj/examples/webrtc_unity_plugin/unity_plugin_apis.obj
ninja: build stopped: subcommand failed.
Message has been deleted
Message has been deleted

Ben Benjamin

unread,
Dec 3, 2017, 7:16:33 PM12/3/17
to discuss-webrtc
Update: I was able to get the dll to build by modifying the line 92 call in simple_peer_connection.cc to include 2 additional nullptr arguments, thus matching the CreatePeerConnectionFactory signature on line 1219 of api/peerconnectioninterface.h. I then copied the code from examples/unityplugin/README into a SimplePeerConnection.cs file/plugin in unity and initiated a PeerConnectionM instance with the same approach as I would to test the browser webrtc API...

Sadly, my call to new PeerConnectionM(stunServers, null, null) causes the entire show to abort (see attachment). Not sure whether the error is in my nullptr additions ^ to force a successful dll build or in my approach to instantiating a PeerConnection using the README code. What I would give for a working demo of this plugin! Again, this comment/PR seems to indicate that there is a working example out there somewhere, but I have failed in numerous attempts to seek one out. Does anyone know of a public repo containing a functional implementation of this C# class?
Capture.PNG
Reply all
Reply to author
Forward
0 new messages