Commit 67699d87 authored by Will Cassella's avatar Will Cassella Committed by Commit Bot

Add special case for |FFmpegDemuxer::SeekInternal| with -INF start_time_

base::TimeDelta will fail a DCHECK if you ever try to add -INF and +INF
time deltas. A consequence of this is if you have a video with a -INF
start_time and you try to seek to +INF, the current code will trigger
that DCHECK. This CL fixes that by settings -INF start times to 0.
This is consistent with how +INF start times are handled.

Bug: 1077685
Change-Id: I4e7fd453aab7a6b15befbb52b708d56febb943ea
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2194917Reviewed-by: default avatarDale Curtis <dalecurtis@chromium.org>
Commit-Queue: Will Cassella <cassew@google.com>
Cr-Commit-Position: refs/heads/master@{#770856}
parent e6afefd2
......@@ -1075,9 +1075,12 @@ void FFmpegDemuxer::SeekInternal(base::TimeDelta time,
// Additionally, to workaround limitations in how we expose seekable ranges to
// Blink (http://crbug.com/137275), we also want to clamp seeks before the
// start time to the start time.
base::TimeDelta seek_time = start_time_ < base::TimeDelta()
? time + start_time_
: time < start_time_ ? start_time_ : time;
base::TimeDelta seek_time;
if (start_time_ < base::TimeDelta()) {
seek_time = time + start_time_;
} else {
seek_time = std::max(start_time_, time);
}
// When seeking in an opus stream we need to ensure we deliver enough data to
// satisfy the seek preroll; otherwise the audio at the actual seek time will
......@@ -1437,7 +1440,7 @@ void FFmpegDemuxer::OnFindStreamInfoDone(int result) {
// Note: This value is used for seeking, so we must take the true value and
// not the one possibly clamped to zero below.
if (start_time < start_time_)
if (start_time != kNoTimestamp && start_time < start_time_)
start_time_ = start_time;
const bool is_opus_or_vorbis =
......
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