Bug 1119033 - Don't try to evict when we don't have any initialized decoders. r=ajones
--- a/dom/media/mediasource/TrackBuffer.cpp
+++ b/dom/media/mediasource/TrackBuffer.cpp
@@ -246,17 +246,17 @@ TrackBuffer::EvictData(uint32_t aThresho
ReentrantMonitorAutoEnter mon(mParentDecoder->GetReentrantMonitor());
int64_t totalSize = 0;
for (uint32_t i = 0; i < mDecoders.Length(); ++i) {
totalSize += mDecoders[i]->GetResource()->GetSize();
}
int64_t toEvict = totalSize - aThreshold;
- if (toEvict <= 0) {
+ if (toEvict <= 0 || mInitializedDecoders.IsEmpty()) {
return false;
}
// Get a list of initialized decoders, sorted by their start times.
nsTArray<SourceBufferDecoder*> decoders;
decoders.AppendElements(mInitializedDecoders);
decoders.Sort(DecoderSorter());