release video after end card reached. fixes video call retry

Daniel Gultsch created

Change summary

src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java | 6 ++
1 file changed, 5 insertions(+), 1 deletion(-)

Detailed changes

src/main/java/eu/siacs/conversations/ui/RtpSessionActivity.java 🔗

@@ -645,7 +645,9 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
     private void updateVideoViews(final RtpEndUserState state) {
         if (END_CARD.contains(state) || state == RtpEndUserState.ENDING_CALL) {
             binding.localVideo.setVisibility(View.GONE);
+            binding.localVideo.release();
             binding.remoteVideo.setVisibility(View.GONE);
+            binding.remoteVideo.release();
             binding.pipLocalMicOffIndicator.setVisibility(View.GONE);
             if (isPictureInPicture()) {
                 binding.appBarLayout.setVisibility(View.GONE);
@@ -811,7 +813,9 @@ public class RtpSessionActivity extends XmppActivity implements XmppConnectionSe
                 updateProfilePicture(state, contact);
             });
             if (END_CARD.contains(state)) {
-                resetIntent(account, with, state, requireRtpConnection().getMedia());
+                final JingleRtpConnection rtpConnection = requireRtpConnection();
+                resetIntent(account, with, state, rtpConnection.getMedia());
+                releaseVideoTracks(rtpConnection);
                 this.rtpConnectionReference = null;
             }
         } else {