Change summary
src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java | 17 ++
1 file changed, 16 insertions(+), 1 deletion(-)
Detailed changes
@@ -270,11 +270,26 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
public void onStop() {
binding.remoteVideo.release();
binding.localVideo.release();
+ final WeakReference<JingleRtpConnection> weakReference = this.rtpConnectionReference;
+ final JingleRtpConnection jingleRtpConnection = weakReference == null ? null : weakReference.get();
+ if (jingleRtpConnection != null) {
+ releaseVideoTracks(jingleRtpConnection);
+ }
releaseProximityWakeLock();
- //TODO maybe we want to finish if call had ended
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
public void onBackPressed() {
endCall();