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;
|
||||
}
|
||||
|
||||
public void setRemoteIp(String remoteIp) { this.remoteIp = remoteIp; }
|
||||
public void setRemoteIp(String remoteIp) {
|
||||
this.remoteIp = remoteIp;
|
||||
UpdateSendDestination();
|
||||
}
|
||||
|
||||
public String remoteIp() { return remoteIp; }
|
||||
|
||||
@ -331,10 +334,7 @@ public class MediaEngine implements VideoDecodeEncodeObserver {
|
||||
|
||||
public void setAudioTxPort(int audioTxPort) {
|
||||
this.audioTxPort = audioTxPort;
|
||||
check(remoteIp != null,
|
||||
"remoteIP must have been set before setting audio send port");
|
||||
check(voe.setSendDestination(audioChannel, audioTxPort,
|
||||
remoteIp) == 0, "VoE set send destination failed");
|
||||
UpdateSendDestination();
|
||||
}
|
||||
|
||||
public int audioTxPort() { return audioTxPort; }
|
||||
@ -539,10 +539,21 @@ public class MediaEngine implements VideoDecodeEncodeObserver {
|
||||
|
||||
public void setVideoTxPort(int videoTxPort) {
|
||||
this.videoTxPort = videoTxPort;
|
||||
check(remoteIp != null,
|
||||
"remoteIP must have been set before setting audio send port");
|
||||
check(vie.setSendDestination(videoChannel, videoTxPort, remoteIp) == 0,
|
||||
"Failed setSendDestination");
|
||||
UpdateSendDestination();
|
||||
}
|
||||
|
||||
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() {
|
||||
|
@ -78,9 +78,11 @@ public class SettingsMenuFragment extends Fragment
|
||||
}
|
||||
});
|
||||
etRemoteIp = (EditText) v.findViewById(R.id.etRemoteIp);
|
||||
etRemoteIp.setOnClickListener(new View.OnClickListener() {
|
||||
public void onClick(View editText) {
|
||||
getEngine().setRemoteIp(etRemoteIp.getText().toString());
|
||||
etRemoteIp.setOnFocusChangeListener(new View.OnFocusChangeListener() {
|
||||
public void onFocusChange(View editText, boolean hasFocus) {
|
||||
if (!hasFocus) {
|
||||
getEngine().setRemoteIp(etRemoteIp.getText().toString());
|
||||
}
|
||||
}
|
||||
});
|
||||
// Has to be after remote IP as loopback changes it.
|
||||
|
Loading…
x
Reference in New Issue
Block a user