Synchronize call statistics update with the LinphoneCore to prevent concurrent access to the statistics structures.

This commit is contained in:
Ghislain MARY 2012-10-09 17:22:52 +02:00
parent 48690086d5
commit 17093d9be5

View file

@ -485,13 +485,14 @@ public class StatusFragment extends Fragment {
return;
}
mHandler.post(new Runnable() {
@Override
public void run() {
synchronized(LinphoneManager.getLc()) {
final LinphoneCallParams params = call.getCurrentParamsCopy();
if (params.getVideoEnabled()) {
final LinphoneCallStats videoStats = call.getVideoStats();
if (videoStats != null) {
mHandler.post(new Runnable() {
@Override
public void run() {
title.setText("Video");
PayloadType payload = params.getUsedVideoCodec();
if (payload != null) {
@ -501,14 +502,9 @@ public class StatusFragment extends Fragment {
ul.setText(String.valueOf((int) videoStats.getUploadBandwidth()) + " kbits/s");
ice.setText(videoStats.getIceState().toString());
}
});
}
} else {
final LinphoneCallStats audioStats = call.getAudioStats();
if (audioStats != null) {
mHandler.post(new Runnable() {
@Override
public void run() {
title.setText("Audio");
PayloadType payload = params.getUsedAudioCodec();
if (payload != null) {
@ -518,10 +514,11 @@ public class StatusFragment extends Fragment {
ul.setText(String.valueOf((int) audioStats.getUploadBandwidth()) + " kbits/s");
ice.setText(audioStats.getIceState().toString());
}
}
}
}
});
}
}
}
};
mTimer.scheduleAtFixedRate(mTask, 0, 1500);
}