Commit 16d25437 authored by Michael Sun's avatar Michael Sun Committed by Commit Bot

CRAS: Fix the handling of position info from Media Session

A variable is initialized inside function MediaSessionPositionChanged
to temporally store duration/length information or remain 0 if duration
is not updated. This blocking the media position from updating as well.

Fixing the issue by add a zero check for the duration before compare to
the position.

BUG=b:147365793

Change-Id: I51d853bf8d618e28ccf75b68cea3c1d02f03b031
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2095413
Commit-Queue: Jenny Zhang <jennyz@chromium.org>
Auto-Submit: Michael Sun <michaelfsun@google.com>
Reviewed-by: default avatarJenny Zhang <jennyz@chromium.org>
Cr-Commit-Position: refs/heads/master@{#748772}
parent 0e2b8eb7
...@@ -290,7 +290,7 @@ void CrasAudioHandler::MediaSessionPositionChanged( ...@@ -290,7 +290,7 @@ void CrasAudioHandler::MediaSessionPositionChanged(
} }
int64_t current_position = position->GetPosition().InMicroseconds(); int64_t current_position = position->GetPosition().InMicroseconds();
if (current_position < 0 || current_position > duration) if (current_position < 0 || (duration > 0 && current_position > duration))
return; return;
CrasAudioClient::Get()->SetPlayerPosition(current_position); CrasAudioClient::Get()->SetPlayerPosition(current_position);
......
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