Commit 6cad7225 authored by Yue Li's avatar Yue Li Committed by Commit Bot

Fix timing issue for delayed media session action

The current implementation of delayed action might bring timing issues:
1. Transiend hold finish
2. The session is resumed
3. Since there is a delayed pause action, the session is suspended
imediately after the resume call, which might bring timing issue

Also, even if the timing issue did not trigger, the media session will
play for a short time before the delayed pause action being executed,
which is also not the ideal behavior.

Bug: b/138330472
Test: Manual Test
Change-Id: I22434b61c83577bcf2ce9769c8ffb5dc17084d68
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2304950Reviewed-by: default avatarBecca Hughes <beccahughes@chromium.org>
Commit-Queue: Yue Li <updowndota@chromium.org>
Cr-Commit-Position: refs/heads/master@{#790073}
parent 10f6bb71
...@@ -125,13 +125,14 @@ void AudioFocusRequest::ReleaseTransientHold() { ...@@ -125,13 +125,14 @@ void AudioFocusRequest::ReleaseTransientHold() {
return; return;
was_suspended_ = false; was_suspended_ = false;
session_->Resume(mojom::MediaSession::SuspendType::kSystem);
if (!delayed_action_) if (delayed_action_) {
PerformUIAction(*delayed_action_);
delayed_action_.reset();
return; return;
}
PerformUIAction(*delayed_action_); session_->Resume(mojom::MediaSession::SuspendType::kSystem);
delayed_action_.reset();
} }
void AudioFocusRequest::PerformUIAction(mojom::MediaSessionAction action) { void AudioFocusRequest::PerformUIAction(mojom::MediaSessionAction action) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment