Changed call stats info
This commit is contained in:
parent
572ba2db94
commit
bef153939f
3 changed files with 351 additions and 79 deletions
|
@ -1,33 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical|center"
|
||||
android:id="@+id/call_stats_audio"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/call_stats_audio"
|
||||
tools:gravity="center" />
|
||||
|
||||
<TableLayout
|
||||
android:id="@+id/callStats"
|
||||
android:id="@+id/callStatsAudio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_gravity="left|center"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp">
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left|center_vertical"
|
||||
android:id="@+id/call_stats_title"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="18sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
@ -42,11 +39,11 @@
|
|||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/codec"
|
||||
android:id="@+id/codec_audio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="right|center_vertical"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
|
@ -66,11 +63,11 @@
|
|||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uploadBandwith"
|
||||
android:id="@+id/uploadBandwith_audio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="right|center_vertical"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
|
@ -90,11 +87,11 @@
|
|||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/downloadBandwith"
|
||||
android:id="@+id/downloadBandwith_audio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="right|center_vertical"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
|
@ -114,18 +111,17 @@
|
|||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ice"
|
||||
android:id="@+id/ice_audio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="right|center_vertical"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/video_resolution_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
|
@ -133,17 +129,257 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left|center_vertical"
|
||||
android:text="@string/call_stats_video_resolution"
|
||||
android:text="@string/call_stats_sender_loss_rate"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/video_resolution"
|
||||
android:id="@+id/senderLossRateAudio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="right|center_vertical"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left|center_vertical"
|
||||
android:text="@string/call_stats_receiver_loss_rate"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/receiverLossRateAudio"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
</TableLayout>
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical|center"
|
||||
android:id="@+id/call_stats_video"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="18sp"
|
||||
android:text="@string/call_stats_video"
|
||||
tools:gravity="center" />
|
||||
|
||||
<TableLayout
|
||||
android:id="@+id/callStatsVideo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="left|center"
|
||||
android:paddingBottom="10dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:paddingRight="5dp">
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left|center_vertical"
|
||||
android:text="@string/call_stats_codec"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/codec_video"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left|center_vertical"
|
||||
android:text="@string/call_stats_upload"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/uploadBandwith_video"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left|center_vertical"
|
||||
android:text="@string/call_stats_download"
|
||||
android:textColor="@color/colorB"
|
||||
android:textStyle="bold"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/downloadBandwith_video"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left|center_vertical"
|
||||
android:text="@string/call_stats_ice"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ice_video"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left|center_vertical"
|
||||
android:text="@string/call_stats_sender_loss_rate"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/senderLossRateVideo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left|center_vertical"
|
||||
android:text="@string/call_stats_receiver_loss_rate"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/receiverLossRateVideo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/video_resolution_layout_sent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left|center_vertical"
|
||||
android:text="@string/call_stats_video_resolution_sent"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/video_resolution_sent"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
</TableRow>
|
||||
|
||||
<TableRow
|
||||
android:id="@+id/video_resolution_layout_received"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="left|center_vertical"
|
||||
android:text="@string/call_stats_video_resolution_received"
|
||||
android:textStyle="bold"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/video_resolution_received"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingLeft="5dp"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textColor="@color/colorB"
|
||||
android:textSize="12sp"/>
|
||||
|
||||
|
|
|
@ -204,7 +204,10 @@
|
|||
<string name="call_stats_upload">Upload bandwidth:</string>
|
||||
<string name="call_stats_download">Download bandwidth:</string>
|
||||
<string name="call_stats_ice">ICE connectivity:</string>
|
||||
<string name="call_stats_video_resolution">Video size:</string>
|
||||
<string name="call_stats_video_resolution_sent">Sent video resolution:</string>
|
||||
<string name="call_stats_video_resolution_received">Received video resolution:</string>
|
||||
<string name="call_stats_sender_loss_rate">Sender loss rate</string>
|
||||
<string name="call_stats_receiver_loss_rate">Receiver loss rate</string>
|
||||
<string name="call">Call</string>
|
||||
|
||||
<!-- About -->
|
||||
|
|
|
@ -438,6 +438,37 @@ public class StatusFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void displayMediaStats(LinphoneCallParams params, LinphoneCallStats stats
|
||||
, PayloadType media , View layout, TextView title, TextView codec, TextView dl
|
||||
, TextView ul, TextView ice, TextView senderLossRate, TextView receiverLossRate
|
||||
, TextView videoResolutionSent, TextView videoResolutionReceived, boolean isVideo) {
|
||||
if (stats != null) {
|
||||
layout.setVisibility(View.VISIBLE);
|
||||
title.setVisibility(TextView.VISIBLE);
|
||||
if (media != null) {
|
||||
String mime = media.getMime();
|
||||
if (LinphoneManager.getLc().openH264Enabled() &&
|
||||
media.getMime().equals("H264") &&
|
||||
LinphoneManager.getInstance().getOpenH264DownloadHelper().isCodecFound()) {
|
||||
mime = "OpenH264";
|
||||
}
|
||||
codec.setText(mime + " / " + (media.getRate() / 1000) + "kHz");
|
||||
}
|
||||
dl.setText(String.valueOf((int) stats.getDownloadBandwidth()) + " kbits/s");
|
||||
ul.setText(String.valueOf((int) stats.getUploadBandwidth()) + " kbits/s");
|
||||
ice.setText(stats.getIceState().toString());
|
||||
senderLossRate.setText(stats.getSenderLossRate() + "%");
|
||||
receiverLossRate.setText(stats.getReceiverLossRate()+ "%");
|
||||
if (isVideo) {
|
||||
videoResolutionSent.setText("\u2191 " + params.getSentVideoSize().toDisplayableString());
|
||||
videoResolutionReceived.setText("\u2193 " + params.getReceivedVideoSize().toDisplayableString());
|
||||
}
|
||||
} else {
|
||||
layout.setVisibility(View.GONE);
|
||||
title.setVisibility(TextView.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
public void initCallStatsRefresher(final LinphoneCall call, final View view) {
|
||||
if (mTimer != null && mTask != null) {
|
||||
return;
|
||||
|
@ -452,15 +483,37 @@ public class StatusFragment extends Fragment {
|
|||
return;
|
||||
}
|
||||
|
||||
final TextView title = (TextView) view.findViewById(R.id.call_stats_title);
|
||||
final TextView codec = (TextView) view.findViewById(R.id.codec);
|
||||
final TextView dl = (TextView) view.findViewById(R.id.downloadBandwith);
|
||||
final TextView ul = (TextView) view.findViewById(R.id.uploadBandwith);
|
||||
final TextView ice = (TextView) view.findViewById(R.id.ice);
|
||||
final TextView videoResolution = (TextView) view.findViewById(R.id.video_resolution);
|
||||
final View videoResolutionLayout = view.findViewById(R.id.video_resolution_layout);
|
||||
final TextView titleAudio = (TextView) view.findViewById(R.id.call_stats_audio);
|
||||
final TextView titleVideo = (TextView) view.findViewById(R.id.call_stats_video);
|
||||
|
||||
if (codec == null || dl == null || ul == null || ice == null || videoResolution == null || videoResolutionLayout == null) {
|
||||
final TextView codecAudio = (TextView) view.findViewById(R.id.codec_audio);
|
||||
final TextView codecVideo = (TextView) view.findViewById(R.id.codec_video);
|
||||
|
||||
final TextView dlAudio = (TextView) view.findViewById(R.id.downloadBandwith_audio);
|
||||
final TextView ulAudio = (TextView) view.findViewById(R.id.uploadBandwith_audio);
|
||||
|
||||
final TextView dlVideo = (TextView) view.findViewById(R.id.downloadBandwith_video);
|
||||
final TextView ulVideo = (TextView) view.findViewById(R.id.uploadBandwith_video);
|
||||
|
||||
final TextView iceAudio = (TextView) view.findViewById(R.id.ice_audio);
|
||||
final TextView iceVideo = (TextView) view.findViewById(R.id.ice_video);
|
||||
|
||||
final TextView videoResolutionSent = (TextView) view.findViewById(R.id.video_resolution_sent);
|
||||
final TextView videoResolutionReceived = (TextView) view.findViewById(R.id.video_resolution_received);
|
||||
|
||||
final TextView senderLossRateAudio = (TextView) view.findViewById(R.id.senderLossRateAudio);
|
||||
final TextView receiverLossRateAudio = (TextView) view.findViewById(R.id.receiverLossRateAudio);
|
||||
|
||||
final TextView senderLossRateVideo = (TextView) view.findViewById(R.id.senderLossRateVideo);
|
||||
final TextView receiverLossRateVideo = (TextView) view.findViewById(R.id.receiverLossRateVideo);
|
||||
|
||||
final View videoLayout = view.findViewById(R.id.callStatsVideo);
|
||||
final View audioLayout = view.findViewById(R.id.callStatsAudio);
|
||||
|
||||
if (titleAudio == null || codecAudio == null || dlVideo == null || iceAudio == null
|
||||
|| videoResolutionSent == null || videoLayout == null || titleVideo == null
|
||||
|| codecVideo == null || dlAudio == null || ulAudio == null
|
||||
|| ulVideo == null || iceVideo == null || videoResolutionReceived == null) {
|
||||
mTimer.cancel();
|
||||
return;
|
||||
}
|
||||
|
@ -469,44 +522,27 @@ public class StatusFragment extends Fragment {
|
|||
@Override
|
||||
public void run() {
|
||||
synchronized(LinphoneManager.getLc()) {
|
||||
final LinphoneCallParams params = call.getCurrentParamsCopy();
|
||||
if (params.getVideoEnabled()) {
|
||||
final LinphoneCallStats videoStats = call.getVideoStats();
|
||||
final LinphoneCallStats audioStats = call.getAudioStats();
|
||||
if (videoStats != null && audioStats != null) {
|
||||
title.setText("Video");
|
||||
PayloadType payloadAudio = params.getUsedAudioCodec();
|
||||
PayloadType payloadVideo = params.getUsedVideoCodec();
|
||||
if (payloadVideo != null && payloadAudio != null) {
|
||||
String videoMime = payloadVideo.getMime();
|
||||
if (LinphoneManager.getLc().openH264Enabled() &&
|
||||
payloadVideo.getMime().equals("H264") &&
|
||||
LinphoneManager.getInstance().getOpenH264DownloadHelper().isCodecFound()) {
|
||||
videoMime = "OpenH264";
|
||||
}
|
||||
codec.setText(videoMime + " / " + payloadAudio.getMime() + (payloadAudio.getRate() / 1000));
|
||||
}
|
||||
dl.setText(String.valueOf((int) videoStats.getDownloadBandwidth()) + " / " + (int) audioStats.getDownloadBandwidth() + " kbits/s");
|
||||
ul.setText(String.valueOf((int) videoStats.getUploadBandwidth()) + " / " + (int) audioStats.getUploadBandwidth() + " kbits/s");
|
||||
ice.setText(videoStats.getIceState().toString());
|
||||
LinphoneCallParams params = call.getCurrentParamsCopy();
|
||||
if (params != null) {
|
||||
LinphoneCallStats audioStats = call.getAudioStats();
|
||||
LinphoneCallStats videoStats = null;
|
||||
|
||||
videoResolutionLayout.setVisibility(View.VISIBLE);
|
||||
videoResolution.setText("\u2191 " + params.getSentVideoSize().toDisplayableString() + " / \u2193 " + params.getReceivedVideoSize().toDisplayableString());
|
||||
}
|
||||
} else {
|
||||
final LinphoneCallStats audioStats = call.getAudioStats();
|
||||
if (audioStats != null) {
|
||||
title.setText("Audio");
|
||||
PayloadType payload = params.getUsedAudioCodec();
|
||||
if (payload != null) {
|
||||
codec.setText(payload.getMime() + (payload.getRate() / 1000));
|
||||
}
|
||||
dl.setText(String.valueOf((int) audioStats.getDownloadBandwidth()) + " kbits/s");
|
||||
ul.setText(String.valueOf((int) audioStats.getUploadBandwidth()) + " kbits/s");
|
||||
ice.setText(audioStats.getIceState().toString());
|
||||
if (params.getVideoEnabled())
|
||||
videoStats = call.getVideoStats();
|
||||
|
||||
videoResolutionLayout.setVisibility(View.GONE);
|
||||
}
|
||||
PayloadType payloadAudio = params.getUsedAudioCodec();
|
||||
PayloadType payloadVideo = params.getUsedVideoCodec();
|
||||
|
||||
displayMediaStats(params, audioStats, payloadAudio, audioLayout
|
||||
, titleAudio, codecAudio, dlAudio, ulAudio, iceAudio
|
||||
, senderLossRateAudio, receiverLossRateAudio, null, null
|
||||
, false);
|
||||
|
||||
displayMediaStats(params, videoStats, payloadVideo, videoLayout
|
||||
, titleVideo, codecVideo, dlVideo, ulVideo, iceVideo
|
||||
, senderLossRateVideo, receiverLossRateVideo
|
||||
, videoResolutionSent, videoResolutionReceived
|
||||
, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -515,7 +551,4 @@ public class StatusFragment extends Fragment {
|
|||
};
|
||||
mTimer.scheduleAtFixedRate(mTask, 0, 1000);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue