findPayloadType() now needs the number of channels in its parameters.
This commit is contained in:
parent
3a66c0490c
commit
590d0f6aa9
3 changed files with 37 additions and 37 deletions
|
@ -648,22 +648,22 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
|
||||
try {
|
||||
// Configure audio codecs
|
||||
// enableDisableAudioCodec("speex", 32000, R.string.pref_codec_speex32_key);
|
||||
enableDisableAudioCodec("speex", 32000, false);
|
||||
enableDisableAudioCodec("speex", 16000, R.string.pref_codec_speex16_key);
|
||||
enableDisableAudioCodec("speex", 8000, R.string.pref_codec_speex8_key);
|
||||
enableDisableAudioCodec("iLBC", 8000, R.string.pref_codec_ilbc_key);
|
||||
enableDisableAudioCodec("GSM", 8000, R.string.pref_codec_gsm_key);
|
||||
enableDisableAudioCodec("G722", 8000, R.string.pref_codec_g722_key);
|
||||
enableDisableAudioCodec("G729", 8000, R.string.pref_codec_g729_key);
|
||||
enableDisableAudioCodec("PCMU", 8000, R.string.pref_codec_pcmu_key);
|
||||
enableDisableAudioCodec("PCMA", 8000, R.string.pref_codec_pcma_key);
|
||||
enableDisableAudioCodec("AMR", 8000, R.string.pref_codec_amr_key);
|
||||
enableDisableAudioCodec("AMR-WB", 16000, R.string.pref_codec_amrwb_key);
|
||||
enableDisableAudioCodec("SILK", 24000, R.string.pref_codec_silk24_key);
|
||||
enableDisableAudioCodec("SILK", 16000, R.string.pref_codec_silk16_key);
|
||||
enableDisableAudioCodec("SILK", 12000, R.string.pref_codec_silk12_key);
|
||||
enableDisableAudioCodec("SILK", 8000, R.string.pref_codec_silk8_key);
|
||||
// enableDisableAudioCodec("speex", 32000, 1, R.string.pref_codec_speex32_key);
|
||||
enableDisableAudioCodec("speex", 32000, 1, false);
|
||||
enableDisableAudioCodec("speex", 16000, 1, R.string.pref_codec_speex16_key);
|
||||
enableDisableAudioCodec("speex", 8000, 1, R.string.pref_codec_speex8_key);
|
||||
enableDisableAudioCodec("iLBC", 8000, 1, R.string.pref_codec_ilbc_key);
|
||||
enableDisableAudioCodec("GSM", 8000, 1, R.string.pref_codec_gsm_key);
|
||||
enableDisableAudioCodec("G722", 8000, 1, R.string.pref_codec_g722_key);
|
||||
enableDisableAudioCodec("G729", 8000, 1, R.string.pref_codec_g729_key);
|
||||
enableDisableAudioCodec("PCMU", 8000, 1, R.string.pref_codec_pcmu_key);
|
||||
enableDisableAudioCodec("PCMA", 8000, 1, R.string.pref_codec_pcma_key);
|
||||
enableDisableAudioCodec("AMR", 8000, 1, R.string.pref_codec_amr_key);
|
||||
enableDisableAudioCodec("AMR-WB", 16000, 1, R.string.pref_codec_amrwb_key);
|
||||
enableDisableAudioCodec("SILK", 24000, 1, R.string.pref_codec_silk24_key);
|
||||
enableDisableAudioCodec("SILK", 16000, 1, R.string.pref_codec_silk16_key);
|
||||
enableDisableAudioCodec("SILK", 12000, 1, R.string.pref_codec_silk12_key);
|
||||
enableDisableAudioCodec("SILK", 8000, 1, R.string.pref_codec_silk8_key);
|
||||
|
||||
|
||||
// Configure video codecs
|
||||
|
@ -744,15 +744,15 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
mLc.setSignalingTransportPorts(ports);
|
||||
}
|
||||
|
||||
private void enableDisableAudioCodec(String codec, int rate, int key) throws LinphoneCoreException {
|
||||
PayloadType pt = mLc.findPayloadType(codec, rate);
|
||||
private void enableDisableAudioCodec(String codec, int rate, int channels, int key) throws LinphoneCoreException {
|
||||
PayloadType pt = mLc.findPayloadType(codec, rate, channels);
|
||||
if (pt !=null) {
|
||||
boolean enable= getPrefBoolean(key,false);
|
||||
mLc.enablePayloadType(pt, enable);
|
||||
}
|
||||
}
|
||||
private void enableDisableAudioCodec(String codec, int rate, boolean enable) throws LinphoneCoreException {
|
||||
PayloadType pt = mLc.findPayloadType(codec, rate);
|
||||
private void enableDisableAudioCodec(String codec, int rate, int channels, boolean enable) throws LinphoneCoreException {
|
||||
PayloadType pt = mLc.findPayloadType(codec, rate, channels);
|
||||
if (pt !=null) {
|
||||
mLc.enablePayloadType(pt, enable);
|
||||
}
|
||||
|
@ -1122,19 +1122,19 @@ public final class LinphoneManager implements LinphoneCoreListener {
|
|||
e.putBoolean(getString(pref_codec_speex32_key), fastCpu);
|
||||
|
||||
boolean ilbc = LinphoneService.isReady() && LinphoneManager.getLc()
|
||||
.findPayloadType("iLBC", 8000)!=null;
|
||||
.findPayloadType("iLBC", 8000, 1)!=null;
|
||||
e.putBoolean(getString(pref_codec_ilbc_key), ilbc);
|
||||
|
||||
boolean amr = LinphoneService.isReady() && LinphoneManager.getLc()
|
||||
.findPayloadType("AMR", 8000)!=null;
|
||||
.findPayloadType("AMR", 8000, 1)!=null;
|
||||
e.putBoolean(getString(pref_codec_amr_key), amr);
|
||||
|
||||
boolean amrwb = LinphoneService.isReady() && LinphoneManager.getLc()
|
||||
.findPayloadType("AMR-WB", 16000)!=null;
|
||||
.findPayloadType("AMR-WB", 16000, 1)!=null;
|
||||
e.putBoolean(getString(pref_codec_amrwb_key), amrwb);
|
||||
|
||||
boolean g729 = LinphoneService.isReady() && LinphoneManager.getLc()
|
||||
.findPayloadType("G729", 8000)!=null;
|
||||
.findPayloadType("G729", 8000, 1)!=null;
|
||||
e.putBoolean(getString(R.string.pref_codec_g729_key), g729);
|
||||
|
||||
if (Version.sdkStrictlyBelow(5) || !Version.hasNeon() || !Hacks.hasCamera()) {
|
||||
|
|
|
@ -84,8 +84,8 @@ public class PreferencesActivity extends LinphonePreferencesActivity implements
|
|||
return (CheckBoxPreference) findPreference(getString(key));
|
||||
}
|
||||
|
||||
private void detectAudioCodec(int id, String mime, int rate, boolean hide) {
|
||||
boolean enable = LinphoneService.isReady() && LinphoneManager.getLc().findPayloadType(mime, rate)!=null;
|
||||
private void detectAudioCodec(int id, String mime, int rate, int channels, boolean hide) {
|
||||
boolean enable = LinphoneService.isReady() && LinphoneManager.getLc().findPayloadType(mime, rate, channels)!=null;
|
||||
Preference cb = findPreference(id);
|
||||
cb.setEnabled(enable);
|
||||
if (hide && !enable) {
|
||||
|
@ -253,7 +253,7 @@ public class PreferencesActivity extends LinphonePreferencesActivity implements
|
|||
|
||||
boolean fastCpu = Version.hasFastCpu();
|
||||
if (fastCpu) {
|
||||
detectAudioCodec(pref_codec_ilbc_key, "iLBC", 8000, false);
|
||||
detectAudioCodec(pref_codec_ilbc_key, "iLBC", 8000, 1, false);
|
||||
findPreference(pref_codec_speex16_key).setEnabled(true);
|
||||
//findPreference(pref_codec_speex32_key)).setEnabled(enableIlbc);
|
||||
}
|
||||
|
@ -261,13 +261,13 @@ public class PreferencesActivity extends LinphonePreferencesActivity implements
|
|||
|
||||
initializeMediaEncryptionPreferences();
|
||||
|
||||
detectAudioCodec(pref_codec_amr_key,"AMR", 8000, false);
|
||||
detectAudioCodec(pref_codec_amrwb_key,"AMR-WB", 16000, false);
|
||||
//detectAudioCodec(R.string.pref_codec_silk8_key,"SILK",8000, true);
|
||||
//detectAudioCodec(R.string.pref_codec_silk12_key,"SILK",12000, true);
|
||||
detectAudioCodec(R.string.pref_codec_silk16_key,"SILK",16000, true);
|
||||
detectAudioCodec(R.string.pref_codec_silk24_key,"SILK",24000, true);
|
||||
detectAudioCodec(R.string.pref_codec_g729_key,"G729",8000, true);
|
||||
detectAudioCodec(pref_codec_amr_key,"AMR", 8000, 1, false);
|
||||
detectAudioCodec(pref_codec_amrwb_key,"AMR-WB", 16000, 1, false);
|
||||
//detectAudioCodec(R.string.pref_codec_silk8_key,"SILK",8000, 1, true);
|
||||
//detectAudioCodec(R.string.pref_codec_silk12_key,"SILK",12000, 1, true);
|
||||
detectAudioCodec(R.string.pref_codec_silk16_key,"SILK",16000, 1, true);
|
||||
detectAudioCodec(R.string.pref_codec_silk24_key,"SILK",24000, 1, true);
|
||||
detectAudioCodec(R.string.pref_codec_g729_key,"G729",8000, 1, true);
|
||||
|
||||
// No video
|
||||
if (!Version.isVideoCapable()) {
|
||||
|
|
|
@ -56,7 +56,7 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
private native void sendDtmf(long nativePtr,char dtmf);
|
||||
private native void clearCallLogs(long nativePtr);
|
||||
private native boolean isMicMuted(long nativePtr);
|
||||
private native long findPayloadType(long nativePtr, String mime, int clockRate);
|
||||
private native long findPayloadType(long nativePtr, String mime, int clockRate, int channels);
|
||||
private native int enablePayloadType(long nativePtr, long payloadType, boolean enable);
|
||||
private native void enableEchoCancellation(long nativePtr,boolean enable);
|
||||
private native boolean isEchoCancellationEnabled(long nativePtr);
|
||||
|
@ -255,9 +255,9 @@ class LinphoneCoreImpl implements LinphoneCore {
|
|||
public synchronized boolean isMicMuted() {
|
||||
return isMicMuted(nativePtr);
|
||||
}
|
||||
public synchronized PayloadType findPayloadType(String mime, int clockRate) {
|
||||
public synchronized PayloadType findPayloadType(String mime, int clockRate, int channels) {
|
||||
isValid();
|
||||
long playLoadType = findPayloadType(nativePtr, mime, clockRate);
|
||||
long playLoadType = findPayloadType(nativePtr, mime, clockRate, channels);
|
||||
if (playLoadType == 0) {
|
||||
return null;
|
||||
} else {
|
||||
|
|
Loading…
Reference in a new issue