Increased required Android API + (hidden) settings to configure audio/video (range) ports

This commit is contained in:
Sylvain Berfini 2012-10-15 11:43:45 +02:00
parent 0a66c6516e
commit d5433a1944
7 changed files with 66 additions and 2 deletions

View file

@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="org.linphone"
android:versionCode="2000" android:versionName="2.0" android:installLocation="auto">
<uses-sdk android:minSdkVersion="5" android:targetSdkVersion="16"/>
<uses-sdk android:minSdkVersion="8" android:targetSdkVersion="16"/>
<!-- Permissions for Push Notification -->
<permission android:name="org.linphone.permission.C2D_MESSAGE" android:protectionLevel="signature" />

View file

@ -111,6 +111,10 @@
<string name="pref_autostart">Démarrer au lancement du téléphone</string>
<string name="pref_enable_outbound_proxy">Outbound proxy</string>
<string name="pref_codecs">Codecs</string>
<string name="pref_communication_expire_title">Time out de communication</string>
<string name="pref_incoming_expire_title">Time out d\'appel entrant</string>
<string name="pref_video_port_title">Port vidéo</string>
<string name="pref_audio_port_title">Port audio</string>
<string name="pref_debug">Activer les traces de débogage</string>
<string name="about_report_issue">Reporter un problème</string>

View file

@ -90,4 +90,9 @@
<string name="pref_push_notification_key">pref_push_notification_key</string>
<string name="pref_auto_accept_friends_key">pref_auto_accept_friends_key</string>
<string name="pref_video_port_key">pref_video_port_key</string>
<string name="pref_audio_port_key">pref_audio_port_key</string>
<string name="pref_incoming_expire_key">pref_incoming_expire_key</string>
<string name="pref_communication_expire_key">pref_communication_expire_key</string>
</resources>

View file

@ -157,6 +157,10 @@
<string name="pref_codec_silk24">silk 24 Khz</string>
<string name="pref_codec_g729">g729</string>
<string name="pref_codecs">Codecs</string>
<string name="pref_communication_expire_title">Communication timeout</string>
<string name="pref_incoming_expire_title">Incoming call timeout</string>
<string name="pref_video_port_title">Video port</string>
<string name="pref_audio_port_title">Audio port</string>
<string name="place_call_chooser">Place a call</string>
<string name="pref_debug">Debug</string>

View file

@ -79,6 +79,12 @@
<CheckBoxPreference
android:key="@string/pref_echo_canceller_calibration_key"
android:title="@string/pref_echo_canceller_calibration" />
<EditTextPreference
android:key="@string/pref_audio_port_key"
android:title="@string/pref_audio_port_title"
android:defaultValue="7078"
android:layout="@layout/hidden"/>
<PreferenceScreen
android:title="@string/pref_codecs"
@ -179,6 +185,12 @@
android:dependency="@string/pref_video_enable_key"
android:layout="@layout/hidden"/>
<EditTextPreference
android:key="@string/pref_video_port_key"
android:title="@string/pref_video_port_title"
android:defaultValue="9078"
android:layout="@layout/hidden"/>
<CheckBoxPreference
android:key="@string/pref_video_automatically_accept_video_key"
android:title="@string/pref_video_automatically_accept_video_title"

View file

@ -646,6 +646,43 @@ public final class LinphoneManager implements LinphoneCoreListener {
}
}
private void readAndSetAudioAndVideoPorts() throws NumberFormatException {
int aPortStart, aPortEnd, vPortStart, vPortEnd;
aPortStart = aPortEnd = 7078;
vPortStart = vPortEnd = 9078;
String audioPort = getPrefString(R.string.pref_audio_port_key, String.valueOf(aPortStart));
String videoPort = getPrefString(R.string.pref_video_port_key, String.valueOf(vPortStart));
if (audioPort.contains("-")) {
// Port range
aPortStart = Integer.parseInt(audioPort.split("-")[0]);
aPortEnd = Integer.parseInt(audioPort.split("-")[1]);
} else {
aPortStart = aPortEnd = Integer.parseInt(audioPort);
}
if (videoPort.contains("-")) {
// Port range
vPortStart = Integer.parseInt(videoPort.split("-")[0]);
vPortEnd = Integer.parseInt(videoPort.split("-")[1]);
} else {
vPortStart = vPortEnd = Integer.parseInt(audioPort);
}
if (aPortStart >= aPortEnd) {
mLc.setAudioPort(aPortStart);
} else {
mLc.setAudioPortRange(aPortStart, aPortEnd);
}
if (vPortStart >= vPortEnd) {
mLc.setVideoPort(vPortStart);
} else {
mLc.setVideoPortRange(vPortStart, vPortEnd);
}
}
public void initFromConf() throws LinphoneConfigException {
LinphoneCoreFactory.instance().setDebugMode(getPrefBoolean(R.string.pref_debug_key, false));
@ -659,6 +696,8 @@ public final class LinphoneManager implements LinphoneCoreListener {
mLc.setVideoPolicy(isAutoInitiateVideoCalls(), isAutoAcceptCamera());
readAndSetAudioAndVideoPorts();
try {
// Configure audio codecs
// enableDisableAudioCodec("speex", 32000, 1, R.string.pref_codec_speex32_key);

@ -1 +1 @@
Subproject commit 0e580208a63ef4559f2e9cdb9f2200129a33b4b8
Subproject commit 78a66ffc91e960f4cd3379495f02a00898235f3e