diff --git a/dom/media/MediaDecoder.cpp b/dom/media/MediaDecoder.cpp index ba7bb30e86fd..ca9cc3d3eb52 100644 --- a/dom/media/MediaDecoder.cpp +++ b/dom/media/MediaDecoder.cpp @@ -659,19 +659,7 @@ bool MediaDecoder::IsExpectingMoreData() { ReentrantMonitorAutoEnter mon(GetReentrantMonitor()); - - // If there's no resource, we're probably just getting set up. - if (!mResource) { - return true; - } - - // If we've downloaded anything, we're not waiting for anything. - if (mResource->IsDataCachedToEndOfResource(mDecoderPosition)) { - return false; - } - - // Otherwise, we should be getting data unless the stream is suspended. - return !mResource->IsSuspended(); + return !mResource || mResource->IsExpectingMoreData(); } void MediaDecoder::MetadataLoaded(nsAutoPtr aInfo, diff --git a/dom/media/MediaResource.h b/dom/media/MediaResource.h index 5f401d7b5c53..87d3794e8916 100644 --- a/dom/media/MediaResource.h +++ b/dom/media/MediaResource.h @@ -407,8 +407,9 @@ public: // an appendBuffer call on a MediaSource element. virtual bool IsExpectingMoreData() { - // TODO: return a sensible value for all sub-classes in next patch. - return false; + // MediaDecoder::mDecoderPosition is roughly the same as Tell() which + // returns a position updated by latest Read() or ReadAt(). + return !IsDataCachedToEndOfResource(Tell()) && !IsSuspended(); } // Returns true if this stream is suspended by the cache because the // cache is full. If true then the decoder should try to start consuming