remove video sinks when calling onStop. otherwise going in and out foreground will give us endless sinks
This commit is contained in:
parent
16d34c2ba0
commit
644e5aa856
|
@ -270,11 +270,26 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
|
||||||
public void onStop() {
|
public void onStop() {
|
||||||
binding.remoteVideo.release();
|
binding.remoteVideo.release();
|
||||||
binding.localVideo.release();
|
binding.localVideo.release();
|
||||||
|
final WeakReference<JingleRtpConnection> weakReference = this.rtpConnectionReference;
|
||||||
|
final JingleRtpConnection jingleRtpConnection = weakReference == null ? null : weakReference.get();
|
||||||
|
if (jingleRtpConnection != null) {
|
||||||
|
releaseVideoTracks(jingleRtpConnection);
|
||||||
|
}
|
||||||
releaseProximityWakeLock();
|
releaseProximityWakeLock();
|
||||||
//TODO maybe we want to finish if call had ended
|
|
||||||
super.onStop();
|
super.onStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void releaseVideoTracks(final JingleRtpConnection jingleRtpConnection) {
|
||||||
|
final Optional<VideoTrack> remoteVideo = jingleRtpConnection.getRemoteVideoTrack();
|
||||||
|
if (remoteVideo.isPresent()) {
|
||||||
|
remoteVideo.get().removeSink(binding.remoteVideo);
|
||||||
|
}
|
||||||
|
final Optional<VideoTrack> localVideo = jingleRtpConnection.geLocalVideoTrack();
|
||||||
|
if (localVideo.isPresent()) {
|
||||||
|
localVideo.get().removeSink(binding.localVideo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onBackPressed() {
|
public void onBackPressed() {
|
||||||
endCall();
|
endCall();
|
||||||
|
|
Loading…
Reference in a new issue