Bug 1194624: [MSE] P2. Enable NextFrameBufferedStatus() for MediaSourceDecoder. r=jwwang

We require a slightly variation on the default implementation as mediasource allows for gaps of up to 125ms between samples and often videos do not start with a time of 0.
This commit is contained in:
Jean-Yves Avenard 2015-12-02 13:01:40 +11:00
parent b43e4839aa
commit 8e5e1f7311
2 changed files with 17 additions and 0 deletions

View File

@ -250,6 +250,21 @@ MediaSourceDecoder::GetDuration()
return ExplicitDuration();
}
MediaDecoderOwner::NextFrameStatus
MediaSourceDecoder::NextFrameBufferedStatus()
{
MOZ_ASSERT(NS_IsMainThread());
// Next frame hasn't been decoded yet.
// Use the buffered range to consider if we have the next frame available.
TimeUnit currentPosition = TimeUnit::FromMicroseconds(CurrentPosition());
TimeInterval interval(currentPosition,
currentPosition + media::TimeUnit::FromMicroseconds(DEFAULT_NEXT_FRAME_AVAILABLE_BUFFERED),
MediaSourceDemuxer::EOS_FUZZ);
return GetBuffered().Contains(interval)
? MediaDecoderOwner::NEXT_FRAME_AVAILABLE
: MediaDecoderOwner::NEXT_FRAME_UNAVAILABLE;
}
#undef MSE_DEBUG
#undef MSE_DEBUGV

View File

@ -77,6 +77,8 @@ public:
void AddSizeOfResources(ResourceSizes* aSizes) override;
MediaDecoderOwner::NextFrameStatus NextFrameBufferedStatus() override;
private:
void DoSetMediaSourceDuration(double aDuration);