mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-10-08 10:44:56 +00:00
Bug 1846396 trim buffered ranges from MP4TrackDemuxer consistently with samples r=padenot
test_buffered.html uses gSeekTests https://searchfox.org/mozilla-central/rev/28bc51699a56f6fa4d0e4d3fe9cded581a70844d/dom/media/test/test_buffered.html#112 Differential Revision: https://phabricator.services.mozilla.com/D188074
This commit is contained in:
parent
956a788047
commit
9fdf7dbff7
@ -599,7 +599,22 @@ TimeIntervals MP4TrackDemuxer::GetBuffered() {
|
||||
return TimeIntervals();
|
||||
}
|
||||
|
||||
return mIndex->ConvertByteRangesToTimeRanges(byteRanges);
|
||||
TimeIntervals timeRanges = mIndex->ConvertByteRangesToTimeRanges(byteRanges);
|
||||
if (AudioInfo* info = mInfo->GetAsAudioInfo(); info) {
|
||||
// Trim as in GetNextSample().
|
||||
TimeUnit totalMediaDurationIncludingTrimming =
|
||||
info->mDuration - info->mMediaTime;
|
||||
auto end = TimeUnit::FromInfinity();
|
||||
if (mType == kAAC && totalMediaDurationIncludingTrimming.IsPositive()) {
|
||||
end = info->mDuration;
|
||||
}
|
||||
if (timeRanges.GetStart().IsNegative() || timeRanges.GetEnd() > end) {
|
||||
TimeInterval trimming(TimeUnit::Zero(timeRanges.GetStart()), end);
|
||||
timeRanges = timeRanges.Intersection(trimming);
|
||||
}
|
||||
}
|
||||
|
||||
return timeRanges;
|
||||
}
|
||||
|
||||
void MP4TrackDemuxer::NotifyDataArrived() { mNeedReIndex = true; }
|
||||
|
@ -951,6 +951,11 @@ var gSeekTests = [
|
||||
{ name: "split.webm", type: "video/webm", duration: 1.967 },
|
||||
{ name: "detodos.opus", type: "audio/ogg; codecs=opus", duration: 2.9135 },
|
||||
{ name: "gizmo.mp4", type: "video/mp4", duration: 5.56 },
|
||||
{
|
||||
name: "/tests/dom/media/webaudio/test/half-a-second-1ch-44100-aac-afconvert.mp4",
|
||||
type: 'audio/mp4; codecs="mp4a.40.2"',
|
||||
duration: 0.5,
|
||||
},
|
||||
{ name: "owl.mp3", type: "audio/mpeg", duration: 3.343 },
|
||||
{ name: "bogus.duh", type: "bogus/duh", duration: 123 },
|
||||
|
||||
|
@ -749,6 +749,7 @@ support-files =
|
||||
wavedata_ulaw.wav^headers^
|
||||
!/dom/canvas/test/captureStream_common.js
|
||||
!/dom/html/test/reflect.js
|
||||
!/dom/media/webaudio/test/half-a-second-1ch-44100-aac-afconvert.mp4
|
||||
!/dom/media/webrtc/tests/mochitests/head.js
|
||||
hls/bipbop_16x9_single.m3u8
|
||||
hls/bipbop_4x3_single.m3u8
|
||||
|
Loading…
Reference in New Issue
Block a user