Bug 1185892. Part 2 - delegate the job of MediaDecoder::IsExpectingMoreData to its MediaResource. r=jya.

This commit is contained in:
JW Wang 2015-07-22 20:57:41 +08:00
Родитель 996ebfa0c1
Коммит cc8b7e3ce1
2 изменённых файлов: 4 добавлений и 15 удалений

Просмотреть файл

@ -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<MediaInfo> aInfo,

Просмотреть файл

@ -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