Fix bugs around the display of LinphoneCallStats in the CallActivity.
This commit is contained in:
parent
ae1065e1ec
commit
767adf809e
3 changed files with 36 additions and 12 deletions
|
@ -22,6 +22,7 @@ import java.util.Arrays;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Timer;
|
import java.util.Timer;
|
||||||
import java.util.TimerTask;
|
import java.util.TimerTask;
|
||||||
|
import java.util.HashMap;
|
||||||
|
|
||||||
import org.linphone.core.CallDirection;
|
import org.linphone.core.CallDirection;
|
||||||
import org.linphone.core.LinphoneAddress;
|
import org.linphone.core.LinphoneAddress;
|
||||||
|
@ -40,6 +41,7 @@ import org.linphone.core.PayloadType;
|
||||||
import org.linphone.mediastream.Log;
|
import org.linphone.mediastream.Log;
|
||||||
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
import org.linphone.mediastream.video.capture.hwconf.AndroidCameraConfiguration;
|
||||||
import org.linphone.ui.Numpad;
|
import org.linphone.ui.Numpad;
|
||||||
|
import org.linphone.mediastream.Factory;
|
||||||
|
|
||||||
import android.Manifest;
|
import android.Manifest;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
|
@ -134,6 +136,8 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
private Handler mHandler = new Handler();
|
private Handler mHandler = new Handler();
|
||||||
private Timer mTimer;
|
private Timer mTimer;
|
||||||
private TimerTask mTask;
|
private TimerTask mTask;
|
||||||
|
private HashMap<String, String> mEncoderTexts;
|
||||||
|
private HashMap<String, String> mDecoderTexts;
|
||||||
|
|
||||||
public static CallActivity instance() {
|
public static CallActivity instance() {
|
||||||
return instance;
|
return instance;
|
||||||
|
@ -175,6 +179,9 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
|
mSensorManager = (SensorManager) getSystemService(Context.SENSOR_SERVICE);
|
||||||
mProximity = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
|
mProximity = mSensorManager.getDefaultSensor(Sensor.TYPE_PROXIMITY);
|
||||||
|
|
||||||
|
mEncoderTexts = new HashMap<String, String>();
|
||||||
|
mDecoderTexts = new HashMap<String, String>();
|
||||||
|
|
||||||
mListener = new LinphoneCoreListenerBase() {
|
mListener = new LinphoneCoreListenerBase() {
|
||||||
@Override
|
@Override
|
||||||
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
public void messageReceived(LinphoneCore lc, LinphoneChatRoom cr, LinphoneChatMessage message) {
|
||||||
|
@ -1627,28 +1634,44 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
tv.setText(Html.fromHtml("<b>" + name + " </b>" + value));
|
tv.setText(Html.fromHtml("<b>" + name + " </b>" + value));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private String getEncoderText(String mime){
|
||||||
|
String ret = mEncoderTexts.get(mime);
|
||||||
|
if (ret == null){
|
||||||
|
org.linphone.mediastream.Factory msfactory = LinphoneManager.getLc().getMSFactory();
|
||||||
|
ret = msfactory.getEncoderText(mime);
|
||||||
|
mEncoderTexts.put(mime, ret);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
private String getDecoderText(String mime){
|
||||||
|
String ret = mDecoderTexts.get(mime);
|
||||||
|
if (ret == null){
|
||||||
|
org.linphone.mediastream.Factory msfactory = LinphoneManager.getLc().getMSFactory();
|
||||||
|
ret = msfactory.getDecoderText(mime);
|
||||||
|
mDecoderTexts.put(mime, ret);
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
|
}
|
||||||
|
|
||||||
private void displayMediaStats(LinphoneCallParams params, LinphoneCallStats stats
|
private void displayMediaStats(LinphoneCallParams params, LinphoneCallStats stats
|
||||||
, PayloadType media , View layout, TextView title, TextView codec, TextView dl
|
, PayloadType media , View layout, TextView title, TextView codec, TextView dl
|
||||||
, TextView ul, TextView ice, TextView ip, TextView senderLossRate
|
, TextView ul, TextView ice, TextView ip, TextView senderLossRate
|
||||||
, TextView receiverLossRate, TextView enc, TextView dec, TextView videoResolutionSent
|
, TextView receiverLossRate, TextView enc, TextView dec, TextView videoResolutionSent
|
||||||
, TextView videoResolutionReceived, boolean isVideo, TextView jitterBuffer) {
|
, TextView videoResolutionReceived, boolean isVideo, TextView jitterBuffer) {
|
||||||
if (stats != null) {
|
if (stats != null) {
|
||||||
|
String mime = null;
|
||||||
|
|
||||||
layout.setVisibility(View.VISIBLE);
|
layout.setVisibility(View.VISIBLE);
|
||||||
title.setVisibility(TextView.VISIBLE);
|
title.setVisibility(TextView.VISIBLE);
|
||||||
if (media != null) {
|
if (media != null) {
|
||||||
String mime = media.getMime();
|
mime = media.getMime();
|
||||||
if (LinphoneManager.getLc().downloadOpenH264Enabled() &&
|
|
||||||
media.getMime().equals("H264") &&
|
|
||||||
LinphoneManager.getInstance().getOpenH264DownloadHelper().isCodecFound()) {
|
|
||||||
mime = "OpenH264";
|
|
||||||
}
|
|
||||||
formatText(codec, getString(R.string.call_stats_codec),
|
formatText(codec, getString(R.string.call_stats_codec),
|
||||||
mime + " / " + (media.getRate() / 1000) + "kHz");
|
mime + " / " + (media.getRate() / 1000) + "kHz");
|
||||||
}
|
}
|
||||||
formatText(enc, getString(R.string.call_stats_encoder_name),
|
if (mime != null ){
|
||||||
stats.getEncoderName(media));
|
formatText(enc, getString(R.string.call_stats_encoder_name), getEncoderText(mime));
|
||||||
formatText(dec, getString(R.string.call_stats_decoder_name),
|
formatText(dec, getString(R.string.call_stats_decoder_name), getDecoderText(mime));
|
||||||
stats.getDecoderName(media));
|
}
|
||||||
formatText(dl, getString(R.string.call_stats_download),
|
formatText(dl, getString(R.string.call_stats_download),
|
||||||
String.valueOf((int) stats.getDownloadBandwidth()) + " kbits/s");
|
String.valueOf((int) stats.getDownloadBandwidth()) + " kbits/s");
|
||||||
formatText(ul, getString(R.string.call_stats_upload),
|
formatText(ul, getString(R.string.call_stats_upload),
|
||||||
|
@ -1711,6 +1734,7 @@ public class CallActivity extends LinphoneGenericActivity implements OnClickList
|
||||||
final View videoLayout = view.findViewById(R.id.callStatsVideo);
|
final View videoLayout = view.findViewById(R.id.callStatsVideo);
|
||||||
final View audioLayout = view.findViewById(R.id.callStatsAudio);
|
final View audioLayout = view.findViewById(R.id.callStatsAudio);
|
||||||
|
|
||||||
|
|
||||||
mTimer = new Timer();
|
mTimer = new Timer();
|
||||||
mTask = new TimerTask() {
|
mTask = new TimerTask() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
Subproject commit 448d0f0ba93f53968fa7d0926fdfe504ea74db89
|
Subproject commit 4c679a7fd653e81e084b803ad627a2dfd5d3eb51
|
|
@ -1 +1 @@
|
||||||
Subproject commit fa21f35941d81971793f6d87d636cecdae686a78
|
Subproject commit cf49dc437c12b90bb78c40d6b91102b08ecd0bd7
|
Loading…
Reference in a new issue