Android, WebRTCDemo: fix issue where changing remote IP was not working properly.
BUG=2783 R=fischman@webrtc.org Review URL: https://webrtc-codereview.appspot.com/7209004 git-svn-id: http://webrtc.googlecode.com/svn/trunk@5396 4adac7df-926f-26a2-2b94-8c16560cd09d
This commit is contained in:
parent
4ffd9c7423
commit
0af1ffa84d
@ -243,7 +243,10 @@ public class MediaEngine implements VideoDecodeEncodeObserver {
|
|||||||
return voeRunning || vieRunning;
|
return voeRunning || vieRunning;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setRemoteIp(String remoteIp) { this.remoteIp = remoteIp; }
|
public void setRemoteIp(String remoteIp) {
|
||||||
|
this.remoteIp = remoteIp;
|
||||||
|
UpdateSendDestination();
|
||||||
|
}
|
||||||
|
|
||||||
public String remoteIp() { return remoteIp; }
|
public String remoteIp() { return remoteIp; }
|
||||||
|
|
||||||
@ -331,10 +334,7 @@ public class MediaEngine implements VideoDecodeEncodeObserver {
|
|||||||
|
|
||||||
public void setAudioTxPort(int audioTxPort) {
|
public void setAudioTxPort(int audioTxPort) {
|
||||||
this.audioTxPort = audioTxPort;
|
this.audioTxPort = audioTxPort;
|
||||||
check(remoteIp != null,
|
UpdateSendDestination();
|
||||||
"remoteIP must have been set before setting audio send port");
|
|
||||||
check(voe.setSendDestination(audioChannel, audioTxPort,
|
|
||||||
remoteIp) == 0, "VoE set send destination failed");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public int audioTxPort() { return audioTxPort; }
|
public int audioTxPort() { return audioTxPort; }
|
||||||
@ -539,10 +539,21 @@ public class MediaEngine implements VideoDecodeEncodeObserver {
|
|||||||
|
|
||||||
public void setVideoTxPort(int videoTxPort) {
|
public void setVideoTxPort(int videoTxPort) {
|
||||||
this.videoTxPort = videoTxPort;
|
this.videoTxPort = videoTxPort;
|
||||||
check(remoteIp != null,
|
UpdateSendDestination();
|
||||||
"remoteIP must have been set before setting audio send port");
|
}
|
||||||
check(vie.setSendDestination(videoChannel, videoTxPort, remoteIp) == 0,
|
|
||||||
"Failed setSendDestination");
|
private void UpdateSendDestination() {
|
||||||
|
if (remoteIp == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (audioTxPort != 0) {
|
||||||
|
check(voe.setSendDestination(audioChannel, audioTxPort,
|
||||||
|
remoteIp) == 0, "VoE set send destination failed");
|
||||||
|
}
|
||||||
|
if (videoTxPort != 0) {
|
||||||
|
check(vie.setSendDestination(videoChannel, videoTxPort, remoteIp) == 0,
|
||||||
|
"Failed setSendDestination");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public int videoTxPort() {
|
public int videoTxPort() {
|
||||||
|
@ -78,9 +78,11 @@ public class SettingsMenuFragment extends Fragment
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
etRemoteIp = (EditText) v.findViewById(R.id.etRemoteIp);
|
etRemoteIp = (EditText) v.findViewById(R.id.etRemoteIp);
|
||||||
etRemoteIp.setOnClickListener(new View.OnClickListener() {
|
etRemoteIp.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||||
public void onClick(View editText) {
|
public void onFocusChange(View editText, boolean hasFocus) {
|
||||||
getEngine().setRemoteIp(etRemoteIp.getText().toString());
|
if (!hasFocus) {
|
||||||
|
getEngine().setRemoteIp(etRemoteIp.getText().toString());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
// Has to be after remote IP as loopback changes it.
|
// Has to be after remote IP as loopback changes it.
|
||||||
|
Loading…
x
Reference in New Issue
Block a user