Add preferred video size selection in the preferences.
This commit is contained in:
parent
3b91aad4f8
commit
9d481cddea
7 changed files with 67 additions and 3 deletions
|
@ -97,7 +97,11 @@
|
|||
<string name="pref_video">Vidéo</string>
|
||||
<string name="pref_preferences">Préférences</string>
|
||||
<string name="pref_video_codecs_title">Codecs</string>
|
||||
|
||||
<string name="pref_preferred_video_size">Taille de vidéo préférée</string>
|
||||
<string name="pref_preferred_video_size_hd">HD</string>
|
||||
<string name="pref_preferred_video_size_vga">VGA (640x480)</string>
|
||||
<string name="pref_preferred_video_size_qvga">QVGA (320x240)</string>
|
||||
|
||||
<string name="pref_video_settings_title">Paramètres vidéo</string>
|
||||
<string name="pref_video_automatically_share_my_video_title">Partager ma vidéo</string>
|
||||
<string name="pref_video_automatically_accept_video_title">Accepter appels vidéo</string>
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
<bool name="pref_video_initiate_call_with_video_default">true</bool>
|
||||
<bool name="pref_video_automatically_share_my_video_default">true</bool>
|
||||
<bool name="pref_video_automatically_accept_video_default">true</bool>
|
||||
<!-- Preferred video size -->
|
||||
<string name="pref_preferred_video_size_default">@string/pref_preferred_video_size_vga_key</string>
|
||||
<!-- Video codecs -->
|
||||
<bool name="pref_video_codec_vp8_default">true</bool>
|
||||
<bool name="pref_video_codec_h264_default">false</bool>
|
||||
|
|
|
@ -65,6 +65,10 @@
|
|||
<string name="pref_video_automatically_accept_video_key">pref_video_automatically_accept_video_key</string>
|
||||
<string name="pref_video_initiate_call_with_video_key">pref_video_initiate_call_with_video_key</string>
|
||||
<string name="pref_video_enable_key">pref_video_enable_key</string>
|
||||
<string name="pref_preferred_video_size_key">pref_preferred_video_size_key</string>
|
||||
<string name="pref_preferred_video_size_hd_key">pref_preferred_video_size_hd_key</string>
|
||||
<string name="pref_preferred_video_size_vga_key">pref_preferred_video_size_vga_key</string>
|
||||
<string name="pref_preferred_video_size_qvga_key">pref_preferred_video_size_qvga_key</string>
|
||||
<string name="pref_animation_enable_key">pref_animation_enable_key</string>
|
||||
<string name="pref_escape_plus_key">pref_escape_plus_key</string>
|
||||
<string name="pref_echo_cancellation_key">pref_echo_cancellation_key</string>
|
||||
|
|
|
@ -119,6 +119,10 @@
|
|||
<string name="pref_video_codec_h264_title">H264</string>
|
||||
<string name="pref_video_codecs_title">Codecs</string>
|
||||
<string name="pref_video_codecs_key">pref_video_codecs_key</string>
|
||||
<string name="pref_preferred_video_size">Preferred video size</string>
|
||||
<string name="pref_preferred_video_size_hd">HD</string>
|
||||
<string name="pref_preferred_video_size_vga">VGA (640x480)</string>
|
||||
<string name="pref_preferred_video_size_qvga">QVGA (320x240)</string>
|
||||
<string name="menu_videocall_back_to_dialer_title">Display dialer</string>
|
||||
<string name="menu_videocall_switch_camera_title">Front/Rear Camera</string>
|
||||
<string name="menu_videocall_change_resolution_when_low_resolution">Try High resolution</string>
|
||||
|
|
|
@ -160,7 +160,12 @@
|
|||
android:defaultValue="@bool/pref_video_automatically_accept_video_default"
|
||||
android:summary="@string/pref_video_automatically_accept_video"
|
||||
android:dependency="@string/pref_video_enable_key"/>
|
||||
|
||||
|
||||
<ListPreference
|
||||
android:title="@string/pref_preferred_video_size"
|
||||
android:key="@string/pref_preferred_video_size_key"
|
||||
android:defaultValue="@string/pref_preferred_video_size_default" />
|
||||
|
||||
<PreferenceCategory
|
||||
android:dependency="@string/pref_video_enable_key"
|
||||
android:shouldDisableView="true"
|
||||
|
|
|
@ -75,6 +75,7 @@ import org.linphone.core.LinphoneInfoMessage;
|
|||
import org.linphone.core.LinphoneProxyConfig;
|
||||
import org.linphone.core.PayloadType;
|
||||
import org.linphone.core.SubscriptionState;
|
||||
import org.linphone.core.VideoSize;
|
||||
import org.linphone.mediastream.Log;
|
||||
import org.linphone.mediastream.Version;
|
||||
import org.linphone.mediastream.video.capture.AndroidVideoApi5JniWrapper;
|
||||
|
@ -869,6 +870,7 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
}
|
||||
boolean isVideoEnabled = isVideoEnabled();
|
||||
mLc.enableVideo(isVideoEnabled, isVideoEnabled);
|
||||
setPreferredVideoSizeFromConfiguration();
|
||||
|
||||
//stun server
|
||||
String lStun = getPrefString(R.string.pref_stun_server_key, getString(R.string.default_stun));
|
||||
|
@ -1006,6 +1008,25 @@ public class LinphoneManager implements LinphoneCoreListener {
|
|||
mLc.enablePayloadType(videoCodec, enable);
|
||||
}
|
||||
|
||||
private void setPreferredVideoSizeFromConfiguration() {
|
||||
String preferredVideoSize = getPrefString(R.string.pref_preferred_video_size_key, getString(R.string.pref_preferred_video_size_vga_key));
|
||||
int bandwidth = 512 + 60;
|
||||
if (preferredVideoSize.equals(getString(R.string.pref_preferred_video_size_hd_key))) {
|
||||
preferredVideoSize = "uxga";
|
||||
bandwidth = 1024 + 60;
|
||||
} else if (preferredVideoSize.equals(getString(R.string.pref_preferred_video_size_vga_key))) {
|
||||
preferredVideoSize = "vga";
|
||||
bandwidth = 512 + 60;
|
||||
} else if (preferredVideoSize.equals(getString(R.string.pref_preferred_video_size_qvga_key))) {
|
||||
preferredVideoSize = "qvga";
|
||||
bandwidth = 380 + 60;
|
||||
}
|
||||
|
||||
mLc.setPreferredVideoSizeByName(preferredVideoSize);
|
||||
mLc.setUploadBandwidth(bandwidth);
|
||||
mLc.setDownloadBandwidth(bandwidth);
|
||||
}
|
||||
|
||||
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
|
||||
private void doDestroy() {
|
||||
ChatStorage.getInstance().close();
|
||||
|
|
|
@ -25,6 +25,7 @@ import static org.linphone.R.string.pref_codec_speex16_key;
|
|||
import static org.linphone.R.string.pref_echo_cancellation_key;
|
||||
import static org.linphone.R.string.pref_echo_canceller_calibration_key;
|
||||
import static org.linphone.R.string.pref_media_encryption_key;
|
||||
import static org.linphone.R.string.pref_preferred_video_size_key;
|
||||
import static org.linphone.R.string.pref_transport_key;
|
||||
import static org.linphone.R.string.pref_video_enable_key;
|
||||
|
||||
|
@ -155,6 +156,8 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
|
|||
}
|
||||
}
|
||||
|
||||
initializePreferredVideoSizePreferences();
|
||||
|
||||
if (prefs().getBoolean(LinphoneActivity.PREF_FIRST_LAUNCH,true)) {
|
||||
doOnFirstLaunch();
|
||||
}
|
||||
|
@ -505,7 +508,28 @@ public class PreferencesFragment extends PreferencesListFragment implements EcCa
|
|||
//mencPref.setValueIndex(mencPref.findIndexOfValue(getString(R.string.media_encryption_none)));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void initializePreferredVideoSizePreferences() {
|
||||
List<CharSequence> entries = new ArrayList<CharSequence>();
|
||||
List<CharSequence> values = new ArrayList<CharSequence>();
|
||||
if (Version.isHDVideoCapable()) {
|
||||
entries.add(getString(R.string.pref_preferred_video_size_hd));
|
||||
values.add(getString(R.string.pref_preferred_video_size_hd_key));
|
||||
}
|
||||
entries.add(getString(R.string.pref_preferred_video_size_vga));
|
||||
values.add(getString(R.string.pref_preferred_video_size_vga_key));
|
||||
entries.add(getString(R.string.pref_preferred_video_size_qvga));
|
||||
values.add(getString(R.string.pref_preferred_video_size_qvga_key));
|
||||
|
||||
ListPreference preferredVideoSize = (ListPreference) findPreference(pref_preferred_video_size_key);
|
||||
CharSequence[] content = new CharSequence[entries.size()];
|
||||
entries.toArray(content);
|
||||
preferredVideoSize.setEntries(content);
|
||||
content = new CharSequence[values.size()];
|
||||
values.toArray(content);
|
||||
preferredVideoSize.setEntryValues(content);
|
||||
}
|
||||
|
||||
private void initializeTransportPreferences() {
|
||||
List<CharSequence> mencEntries=new ArrayList<CharSequence>();
|
||||
List<CharSequence> mencEntryValues=new ArrayList<CharSequence>();
|
||||
|
|
Loading…
Reference in a new issue