通过WebRTC本身和其他业务重用第三方

时间:2017-12-08 08:53:59

标签: ios dynamic webrtc code-reuse opus

现场情况如下:

  1. 我有一个名为opus.framework的opus框架,它是iOS平台上的动态库,将被其他一些业务使用 ,假设这项业务是" A"。
  2. WebRTC项目中有第三方opus编解码器,但现在我 想要将其替换为前面提到的opus.framework。所以" A"
    和WebRTC本身可以重用相同的opus.framework。
  3. WebRTC.framework被编译为动态框架。
  4. 当然,我们可以提前加载opus.framework WebRTC.framework
  5. 我修改了./webrtc/modules/audio_coding/BUILD.gn进行编译" webrtc_opus"如下

    rtc_static_library("webrtc_opus") {
      sources = [
        "codecs/opus/audio_decoder_opus.cc",
        "codecs/opus/audio_decoder_opus.h",
        "codecs/opus/audio_encoder_opus.cc",
        "codecs/opus/audio_encoder_opus.h",
        "codecs/opus/opus_inst.h",
        "codecs/opus/opus_interface.c",
        "codecs/opus/opus_interface.h",
      ]
    
      deps = [
        ":audio_decoder_interface",
        ":audio_encoder_interface",
        ":audio_network_adaptor",
        "../../base:rtc_base_approved",
      ]
    
      if (rtc_build_opus) {
       //opus.framework is located at /src/extern/opus/ in the WebRTC source project
       include_dirs=["//extern/opus","//extern/opus/opus.framework/Headers"]
       rpath_link="//extern/opus/"
       ldflags = ["-Wl,-rpath=\$ORIGIN/${rpath_link}",
                  "-Wl,-rpath-link=${rpath_link}",
                  "-force_load"]
    
       libs = ["opus.framework"]
      } 
    }
    

    我得到的错误如下:

        ld: framework not found opus
    clang++: error: linker command failed with exit code 1 (use -v to see invocation)
    Traceback (most recent call last):
      File "../../build/toolchain/mac/linker_driver.py", line 229, in <module>
        Main(sys.argv)
      File "../../build/toolchain/mac/linker_driver.py", line 79, in Main
        subprocess.check_call(compiler_driver_args)
      File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/subprocess.py", line 540, in check_call
        raise CalledProcessError(retcode, cmd)
    subprocess.CalledProcessError: Command '['../../third_party/llvm-build/Release+Asserts/bin/clang++', '-shared', '-all_load', '-Xlinker', '-install_name', '-Xlinker', '@rpath/WebRTC.framework/WebRTC', '-Xlinker', '-objc_abi_version', '-Xlinker', '2', '-arch', 'arm64', '-Wl,-dead_strip', '-isysroot', '/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS11.1.sdk', '-stdlib=libc++', '-miphoneos-version-min=8.0', '-Wl,-ObjC', '-L../../extern/opus', '-o', 'obj/webrtc/sdk/arm64/WebRTC', '-Wl,-filelist,obj/webrtc/sdk/arm64/WebRTC.rsp', '-framework', 'AVFoundation', '-framework', 'AudioToolbox', '-framework', 'CoreGraphics', '-framework', 'CoreMedia', '-framework', 'GLKit', '-framework', 'VideoToolbox', '-framework', 'CoreFoundation', '-framework', 'CoreText', '-framework', 'Foundation', '-framework', 'CFNetwork', '-framework', 'Security', '-framework', 'SystemConfiguration', '-framework', 'UIKit', '-framework', 'CoreVideo', '-framework', 'OpenGLES', '-framework', 'QuartzCore', '-framework', 'opus']'
    

    如果有人能把我拉出来,我们将非常感激。有一个解决方案,可以通过&#34; A&#34;重新使用opus.framework。和WebRTC?

0 个答案:

没有答案