summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java9
-rw-r--r--java/com/android/incallui/videotech/ims/ImsVideoTech.java22
2 files changed, 30 insertions, 1 deletions
diff --git a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java
index 17c2e6518..f4e0a01ea 100644
--- a/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java
+++ b/java/com/android/incallui/videotech/ims/ImsVideoCallCallback.java
@@ -161,14 +161,23 @@ public class ImsVideoCallCallback extends VideoCall.Callback {
}
}
+ // In the vendor code rx_pause and rx_resume get triggered when the video player starts or stops
+ // playing the incoming video stream. For the case where you're resuming a held call, its
+ // definitely a good signal to use to know that the video is resuming (though the video state
+ // should change to indicate its not paused in this case as well). However, keep in mind you'll
+ // get these signals as well on carriers that don't support the video pause signalling (like TMO)
+ // so you want to ensure you don't send sessionModifyRequests with pause/resume based on these
+ // signals. Also, its technically possible to have a pause/resume if the video signal degrades.
@Override
public void onCallSessionEvent(int event) {
switch (event) {
case Connection.VideoProvider.SESSION_EVENT_RX_PAUSE:
LogUtil.i("ImsVideoCallCallback.onCallSessionEvent", "rx_pause");
+ videoTech.onPausedEvent();
break;
case Connection.VideoProvider.SESSION_EVENT_RX_RESUME:
LogUtil.i("ImsVideoCallCallback.onCallSessionEvent", "rx_resume");
+ videoTech.onResumedEvent();
break;
case Connection.VideoProvider.SESSION_EVENT_CAMERA_FAILURE:
LogUtil.i("ImsVideoCallCallback.onCallSessionEvent", "camera_failure");
diff --git a/java/com/android/incallui/videotech/ims/ImsVideoTech.java b/java/com/android/incallui/videotech/ims/ImsVideoTech.java
index a6cef7b81..3d73e4e7d 100644
--- a/java/com/android/incallui/videotech/ims/ImsVideoTech.java
+++ b/java/com/android/incallui/videotech/ims/ImsVideoTech.java
@@ -19,6 +19,7 @@ package com.android.incallui.videotech.ims;
import android.content.Context;
import android.os.Build;
import android.support.annotation.Nullable;
+import android.support.annotation.VisibleForTesting;
import android.telecom.Call;
import android.telecom.Call.Details;
import android.telecom.VideoProfile;
@@ -40,7 +41,8 @@ public class ImsVideoTech implements VideoTech {
private @SessionModificationState int sessionModificationState =
SessionModificationState.NO_REQUEST;
private int previousVideoState = VideoProfile.STATE_AUDIO_ONLY;
- private boolean paused = false;
+
+ @VisibleForTesting boolean paused = false;
public ImsVideoTech(LoggingBindings logger, VideoTechListener listener, Call call) {
this.logger = logger;
@@ -247,6 +249,24 @@ public class ImsVideoTech implements VideoTech {
call.getVideoCall().setDeviceOrientation(rotation);
}
+ /**
+ * Called when we receive an rx_pause from the IMS stack. Update our state so we know we are
+ * currently paused. This is important in the cases where we swap calls since pause() and
+ * unpause() are not called.
+ */
+ void onPausedEvent() {
+ paused = true;
+ }
+
+ /**
+ * Called when we receive an rx_resume from the IMS stack. Update our state so we know we are
+ * currently not paused. This is important in the cases where we swap calls since pause() and
+ * unpause() are not called.
+ */
+ void onResumedEvent() {
+ paused = false;
+ }
+
private boolean canPause() {
return call.getDetails().can(Details.CAPABILITY_CAN_PAUSE_VIDEO)
&& call.getState() == Call.STATE_ACTIVE