Skip to content
This repository has been archived by the owner on Aug 4, 2022. It is now read-only.

Commit

Permalink
Bug 1127203 - Use the tolerance value in TrackBuffersContainTime so t…
Browse files Browse the repository at this point in the history
…hat seeking operates with tolerance too. r=mattwoodrow
  • Loading branch information
bholley committed Jan 31, 2015
1 parent fb0b5b6 commit c2185b9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions dom/media/mediasource/MediaSourceReader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -642,10 +642,10 @@ bool
MediaSourceReader::TrackBuffersContainTime(int64_t aTime)
{
ReentrantMonitorAutoEnter mon(mDecoder->GetReentrantMonitor());
if (mAudioTrack && !mAudioTrack->ContainsTime(aTime)) {
if (mAudioTrack && !mAudioTrack->ContainsTime(aTime, EOS_FUZZ_US)) {
return false;
}
if (mVideoTrack && !mVideoTrack->ContainsTime(aTime)) {
if (mVideoTrack && !mVideoTrack->ContainsTime(aTime, EOS_FUZZ_US)) {
return false;
}
return true;
Expand Down
5 changes: 3 additions & 2 deletions dom/media/mediasource/TrackBuffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -584,13 +584,14 @@ TrackBuffer::IsReady()
}

bool
TrackBuffer::ContainsTime(int64_t aTime)
TrackBuffer::ContainsTime(int64_t aTime, int64_t aTolerance)
{
ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
for (uint32_t i = 0; i < mInitializedDecoders.Length(); ++i) {
nsRefPtr<dom::TimeRanges> r = new dom::TimeRanges();
mInitializedDecoders[i]->GetBuffered(r);
if (r->Find(double(aTime) / USECS_PER_S) != dom::TimeRanges::NoIndex) {
if (r->Find(double(aTime) / USECS_PER_S,
double(aTolerance) / USECS_PER_S) != dom::TimeRanges::NoIndex) {
return true;
}
}
Expand Down
2 changes: 1 addition & 1 deletion dom/media/mediasource/TrackBuffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ class TrackBuffer MOZ_FINAL {

// Returns true if any of the decoders managed by this track buffer
// contain aTime in their buffered ranges.
bool ContainsTime(int64_t aTime);
bool ContainsTime(int64_t aTime, int64_t aTolerance);

void BreakCycles();

Expand Down

0 comments on commit c2185b9

Please sign in to comment.