cwliu / linphone-swift-demo

A simple demo to integrate liblinphone SDK in Swift
40 stars 10 forks source link

Enable G729 usage #5

Open kmiloaguilar opened 8 years ago

kmiloaguilar commented 8 years ago

I see how to load the codec based on the sample they provide. I was able to replicate it using your project, code is something like this:

// Load plugins if available in the linphone SDK - otherwise these calls will do nothing let factory = linphone_core_get_ms_factory(lc); libmssilk_init(factory); libmsamr_init(factory); libmsx264_init(factory); libmsopenh264_init(factory); libmsbcg729_init(factory); libmswebrtc_init(factory); linphone_core_reload_ms_plugins(lc, nil)

But the problem I have is, how to enable the use of the codec. At least in their sample app when it's loaded it shows in their settings but to use it you have to enable it. Do you have an idea on how to load and enable that codec?

asyurafadilah commented 7 years ago
  1. add this at your bridging header file :

extern void libmsamr_init(MSFactory factory); extern void libmsx264_init(MSFactory factory); extern void libmsopenh264_init(MSFactory factory); extern void libmssilk_init(MSFactory factory); extern void libmsbcg729_init(MSFactory factory); extern void libmswebrtc_init(MSFactory factory);

  1. add this code at your linphoneManager.swift :

    • Location after "linphone_core_new_with_config"

      if let factory = linphone_core_get_ms_factory(theLinphone.lc){ libmssilk_init(factory) libmsamr_init(factory) libmsx264_init(factory) libmsopenh264_init(factory) libmsbcg729_init(factory) libmswebrtc_init(factory) linphone_core_reload_ms_plugins(theLinphone.lc, nil) }