Severd
Severd

Reputation: 53

How to change the list of default audio codecs in Linphone

I want to set codec G729 default enabled. I searched on StackOverflow and found many deprecated solutions, but now, they are no longer working.

I wrote some temporary (terrible) code that sets a flag every time you start the application. But I would like a normal solution.

Upvotes: 2

Views: 6357

Answers (3)

Cui Gang
Cui Gang

Reputation: 61

Modify the file: linphonerc

[audio_codec_0]
mime=G729
rate=8000
enabled=1

Delete your APP on iPhone or simulator, build and run. You will found codec G729 is enabled.

Upvotes: 3

Severd
Severd

Reputation: 53

The solution, by Forced ON:

try {
    PayloadType ptG729 = LinphoneManager.getLc().findPayloadType("G729");
    LinphoneManager.getLc().enablePayloadType(ptG729, true);
} catch (LinphoneCoreException e) {
    Log.e(e,"Unable to modify status for codec " + "G729");
}

This code can be added to LinphoneActivity.java for example, to call at the first application start

protected void onCreate(Bundle savedInstanceState) {
...
    if (LinphonePreferences.instance().getAccountCount() > 0) {
        LinphonePreferences.instance().firstLaunchSuccessful();
    } else {
        startActivityForResult(new Intent().setClass(this, SetupActivity.class), FIRST_LOGIN_ACTIVITY);
//Forced ON  G729
//<<<<<<<<<<<<<<<
    }
...
}

Upvotes: 2

Vladimir Ivanov
Vladimir Ivanov

Reputation: 43108

To use G729 codec you need:

  1. Compile linphone with G729 support, checkout build files for the appropriate build flag
  2. Change the codec list by calling enablePayloadType
  3. Set it as preffered by setting it as a first one

Upvotes: 2

Related Questions