diff options
author | Tyler Gunn <tgunn@google.com> | 2017-07-14 11:17:21 -0700 |
---|---|---|
committer | Tyler Gunn <tgunn@google.com> | 2017-07-14 13:48:35 -0700 |
commit | 28552fbbf08d9652b259aaae8661f98d865408c1 (patch) | |
tree | 7df1ba410ecb32216fd5ea9ee700e6f81e47f42c | |
parent | 567a70c96dcab6d5d78a73f3aaab87e551ce25a5 (diff) | |
download | ims-28552fbbf08d9652b259aaae8661f98d865408c1.tar.gz |
Filter resume requests when video is already resumed.oreo-dr1-dev
If the request being sent to the video provider is to resume the video,
but the video stream is already resumed, do not send this request to the
modem.
In the case of swapping between calls, the video appears to resume
automatically on the modem-side, so sending another resume request is
redundant.
Also, in VideoPauseTracker, correcting the case where we get a resume
request, but there are no remaining pause requests in the tracker.
Although that case shouldn't run up in reality, if it did we should still
let the resume request pass along (since it would otherwise be re-written
as a pause).
Test: Manual test.
Change-Id: Ib9b9acaf2d92b1485e4766a13701fd472d6c117d
Fixes: 63606238
-rw-r--r-- | src/java/com/android/ims/internal/ImsVideoCallProviderWrapper.java | 10 | ||||
-rw-r--r-- | src/java/com/android/ims/internal/VideoPauseTracker.java | 8 |
2 files changed, 16 insertions, 2 deletions
diff --git a/src/java/com/android/ims/internal/ImsVideoCallProviderWrapper.java b/src/java/com/android/ims/internal/ImsVideoCallProviderWrapper.java index 8a06f3c3..ca4078f9 100644 --- a/src/java/com/android/ims/internal/ImsVideoCallProviderWrapper.java +++ b/src/java/com/android/ims/internal/ImsVideoCallProviderWrapper.java @@ -284,6 +284,16 @@ public class ImsVideoCallProviderWrapper extends Connection.VideoProvider { } try { + if (isResumeRequest(fromProfile.getVideoState(), toProfile.getVideoState()) && + !VideoProfile.isPaused(mCurrentVideoState)) { + // Request is to resume, but we're already resumed so ignore the request. + Log.i(this, "onSendSessionModifyRequest: fromVideoState=%s, toVideoState=%s; " + + "skipping resume request - already resumed.", + VideoProfile.videoStateToString(fromProfile.getVideoState()), + VideoProfile.videoStateToString(toProfile.getVideoState())); + return; + } + toProfile = maybeFilterPauseResume(fromProfile, toProfile, VideoPauseTracker.SOURCE_INCALL); diff --git a/src/java/com/android/ims/internal/VideoPauseTracker.java b/src/java/com/android/ims/internal/VideoPauseTracker.java index a23c5901..baa3163f 100644 --- a/src/java/com/android/ims/internal/VideoPauseTracker.java +++ b/src/java/com/android/ims/internal/VideoPauseTracker.java @@ -123,8 +123,12 @@ public class VideoPauseTracker { } else { Log.i(this, "shouldResumeVideoFor: source=%s, pendingRequests=%s - not paused", sourceToString(source), sourcesToString(mPauseRequests)); - // Video wasn't paused, so don't resume. - return false; + // Although there are no pending pause requests, it is possible that we cleared the + // pause tracker because the video state reported we're un-paused. In this case it + // is benign to just allow the resume request to be sent since it'll have no effect. + // Re-writing it to squelch the resume would end up causing it to be a pause + // request, which is bad. + return true; } } } |