Search Unity

  1. Unity Asset Manager is now available in public beta. Try it out now and join the conversation here in the forums.
    Dismiss Notice

Question Has anyone been able to customize and rebuild the WebRTC package?

Discussion in 'Unity Render Streaming' started by a_willette, Dec 29, 2020.

  1. a_willette

    a_willette

    Joined:
    Nov 20, 2020
    Posts:
    2
    I'm trying to add stereo audio support to the render streaming package, which I believe requires modifying the underlying WebRTC package.
    I'm following the instructions here (for windows): https://github.com/Unity-Technologies/com.unity.webrtc/blob/develop/Plugin~/README.md

    Problem is, I get to the "Build plugin" step and cmake isn't able to find the libwebrtc package. There's no cmake file in the .zip folder I downloaded from the releases page, which I suspect could be the problem, but I don't know how to fix it.

    The provided screenshots of the folder structure don't seem accurate to me, and I'm a bit confused where to put the "lib" and "include" folders that I unpacked from the libwebrtc zip. Has anyone had success going through this process, and if so could you explain to me how you did it? Any help would be greatly appreciated.

    This is the full error from cmake:
    CMake Error at C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:218 (message):
    Could NOT find WebRTC (missing: WEBRTC_LIBRARY WEBRTC_LIBRARY_DEBUG)
    Call Stack (most recent call first):
    C:/Program Files/CMake/share/cmake-3.19/Modules/FindPackageHandleStandardArgs.cmake:582 (_FPHSA_FAILURE_MESSAGE)
    cmake/FindWebRTC.cmake:48 (find_package_handle_standard_args)
    CMakeLists.txt:62 (find_package)
     
  2. gauzinski

    gauzinski

    Joined:
    Jun 29, 2019
    Posts:
    2
  3. SimplyVideoJordan

    SimplyVideoJordan

    Joined:
    Mar 25, 2021
    Posts:
    2
    @gauzinski is correct but be wary @aaron_willette and any lucky soul which finds this thread, it can fail even with WebRTC in the correct place.

    A hack that you can do is replace "${CMAKE_ANDROID_ARCH}" (check 1a of the screenshot) with one of the folders that actually exists in your working directory, such as "arm64" or "x64" (check 1b of the screenshot). Then change the set(WEBRTC_LIBRARY) to how it looks in #2 of the screenshot.

    This is because earlier in the build_plugin_android.sh, CMAKE_ANDROID_ARCH_ABI is set to arm64-v8a. This causes CMAKE_ANDROID_ARCH to change to the same value, because in the docs, CMAKE_ANDROID_ARCH is set to CMAKE_ANDROID_ARCH_ABI when you're using the Makefiles generator (the default for Linux and WSL2 on Windows). For some reason, the build script does not download a version of libwebrtc that contains the arm64-v8a libraries. Clearly it's been deprecated from the last 2 years.

    This is hacky, it modifies how the CMake actually works, but once it's done it doesn't have to be configured again. Previously, I've only changed #2 of the screenshot and the build works out fine. Not really sure what to make of that.

    Hope this saves someone a day of work.

    upload_2022-1-12_12-3-52.png
     

    Attached Files:

    patsku likes this.