Prevent sending a re-invite when we have accepted a re-invite to enable/disable video.

This commit is contained in:
Ghislain MARY 2013-01-23 12:30:35 +01:00
parent c89b3a8d32
commit 9ecc101f04

View file

@ -323,7 +323,7 @@ public class InCallActivity extends FragmentActivity implements
if (id == R.id.video) { if (id == R.id.video) {
isVideoEnabled = !isVideoEnabled; isVideoEnabled = !isVideoEnabled;
switchVideo(isVideoEnabled); switchVideo(isVideoEnabled, true);
} }
else if (id == R.id.micro) { else if (id == R.id.micro) {
toggleMicro(); toggleMicro();
@ -386,7 +386,7 @@ public class InCallActivity extends FragmentActivity implements
}); });
} }
private void switchVideo(final boolean displayVideo) { private void switchVideo(final boolean displayVideo, final boolean isInitiator) {
final LinphoneCall call = LinphoneManager.getLc().getCalls()[0]; final LinphoneCall call = LinphoneManager.getLc().getCalls()[0];
if (call == null) { if (call == null) {
return; return;
@ -396,10 +396,11 @@ public class InCallActivity extends FragmentActivity implements
@Override @Override
public void run() { public void run() {
if (!displayVideo) { if (!displayVideo) {
if (isInitiator) {
LinphoneCallParams params = call.getCurrentParamsCopy(); LinphoneCallParams params = call.getCurrentParamsCopy();
params.setVideoEnabled(false); params.setVideoEnabled(false);
LinphoneManager.getLc().updateCall(call, params); LinphoneManager.getLc().updateCall(call, params);
}
showAudioView(); showAudioView();
} else { } else {
if (!call.getRemoteParams().isLowBandwidthEnabled()) { if (!call.getRemoteParams().isLowBandwidthEnabled()) {
@ -965,7 +966,7 @@ public class InCallActivity extends FragmentActivity implements
boolean isVideoEnabledInCall = call.getCurrentParamsCopy().getVideoEnabled(); boolean isVideoEnabledInCall = call.getCurrentParamsCopy().getVideoEnabled();
if (isVideoEnabledInCall != isVideoEnabled) { if (isVideoEnabledInCall != isVideoEnabled) {
isVideoEnabled = isVideoEnabledInCall; isVideoEnabled = isVideoEnabledInCall;
switchVideo(isVideoEnabled); switchVideo(isVideoEnabled, false);
} }
// The following should not be needed except some devices need it (e.g. Galaxy S). // The following should not be needed except some devices need it (e.g. Galaxy S).