Commit aff43787 authored by Jinho Bang's avatar Jinho Bang Committed by Commit Bot

MediaSession: Fix a crash when calling seekTo(0) on debug build

Currently, the MediaSession.seekTo() in Java allows 0, but the JNI
implementation doesn't allow 0. According to the method's
description[1], it allows non-negative numbers. So, the JNI code should
allow 0 as well. This issue was discovered while testing in downstream
code.

[1] https://source.chromium.org/chromium/chromium/src/+/master:content/public/android/java/src/org/chromium/content_public/browser/MediaSession.java;l=59

Bug: none
Change-Id: I68481c484f40bd28259a98dd553c42ed3855e4ba
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2519633Reviewed-by: default avatarBecca Hughes <beccahughes@chromium.org>
Commit-Queue: Jinho Bang <jinho.bang@samsung.com>
Cr-Commit-Position: refs/heads/master@{#824151}
parent e1da12a7
......@@ -223,7 +223,7 @@ void MediaSessionAndroid::SeekTo(
const base::android::JavaParamRef<jobject>& j_obj,
const jlong millis) {
DCHECK(media_session_);
DCHECK_GT(millis, 0) << "Attempted to seek to a negative position";
DCHECK_GE(millis, 0) << "Attempted to seek to a negative position";
media_session_->SeekTo(base::TimeDelta::FromMilliseconds(millis));
}
......
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