Loading dom/media/MediaDecoder.cpp +23 −14 Original line number Diff line number Diff line Loading @@ -1295,31 +1295,40 @@ IntervalType MediaDecoder::GetSeekableImpl() { return IntervalType(); } // Compute [0, duration] -- When dealing with doubles, use ::GetDuration to // avoid rounding the value differently. When dealing with TimeUnit, it's // returned directly. typename IntervalType::InnerType duration; if constexpr (std::is_same<typename IntervalType::InnerType, double>::value) { duration = GetDuration(); } else { duration = mDuration.as<TimeUnit>(); } typename IntervalType::ElemType zeroToDuration = typename IntervalType::ElemType( Zero<typename IntervalType::InnerType>(), IsInfinite() ? Infinity<typename IntervalType::InnerType>() : duration); auto buffered = IntervalType(GetBuffered()); // Remove any negative range in the interval -- seeking to a non-positive // position isn't possible. auto positiveBuffered = buffered.Intersection(zeroToDuration); // We can seek in buffered range if the media is seekable. Also, we can seek // in unbuffered ranges if the transport level is seekable (local file or the // server supports range requests, etc.) or in cue-less WebMs if (mMediaSeekableOnlyInBufferedRanges) { return IntervalType(GetBuffered()); return IntervalType(positiveBuffered); } if (!IsMediaSeekable()) { return IntervalType(); } if (!IsTransportSeekable()) { return IntervalType(GetBuffered()); } // Return [0, duration] -- When dealing with doubles, use ::GetDuration to // avoid rounding the value differently. When dealing with TimeUnit, it's // returned directly. typename IntervalType::InnerType duration; if constexpr (std::is_same<typename IntervalType::InnerType, double>::value) { duration = GetDuration(); } else { duration = mDuration.as<TimeUnit>(); return IntervalType(positiveBuffered); } return IntervalType(typename IntervalType::ElemType( Zero<typename IntervalType::InnerType>(), IsInfinite() ? Infinity<typename IntervalType::InnerType>() : duration)); // Common case: seeking is possible at any point of the stream. return IntervalType(zeroToDuration); } media::TimeIntervals MediaDecoder::GetSeekable() { Loading Loading
dom/media/MediaDecoder.cpp +23 −14 Original line number Diff line number Diff line Loading @@ -1295,31 +1295,40 @@ IntervalType MediaDecoder::GetSeekableImpl() { return IntervalType(); } // Compute [0, duration] -- When dealing with doubles, use ::GetDuration to // avoid rounding the value differently. When dealing with TimeUnit, it's // returned directly. typename IntervalType::InnerType duration; if constexpr (std::is_same<typename IntervalType::InnerType, double>::value) { duration = GetDuration(); } else { duration = mDuration.as<TimeUnit>(); } typename IntervalType::ElemType zeroToDuration = typename IntervalType::ElemType( Zero<typename IntervalType::InnerType>(), IsInfinite() ? Infinity<typename IntervalType::InnerType>() : duration); auto buffered = IntervalType(GetBuffered()); // Remove any negative range in the interval -- seeking to a non-positive // position isn't possible. auto positiveBuffered = buffered.Intersection(zeroToDuration); // We can seek in buffered range if the media is seekable. Also, we can seek // in unbuffered ranges if the transport level is seekable (local file or the // server supports range requests, etc.) or in cue-less WebMs if (mMediaSeekableOnlyInBufferedRanges) { return IntervalType(GetBuffered()); return IntervalType(positiveBuffered); } if (!IsMediaSeekable()) { return IntervalType(); } if (!IsTransportSeekable()) { return IntervalType(GetBuffered()); } // Return [0, duration] -- When dealing with doubles, use ::GetDuration to // avoid rounding the value differently. When dealing with TimeUnit, it's // returned directly. typename IntervalType::InnerType duration; if constexpr (std::is_same<typename IntervalType::InnerType, double>::value) { duration = GetDuration(); } else { duration = mDuration.as<TimeUnit>(); return IntervalType(positiveBuffered); } return IntervalType(typename IntervalType::ElemType( Zero<typename IntervalType::InnerType>(), IsInfinite() ? Infinity<typename IntervalType::InnerType>() : duration)); // Common case: seeking is possible at any point of the stream. return IntervalType(zeroToDuration); } media::TimeIntervals MediaDecoder::GetSeekable() { Loading