Bug 1191813: [mp3] P1. Avoid false positive EOS detection. r=esawin

We do so by using blocking reads via the MediaSourceIndex::ReadAt convenience method.
This commit is contained in:
Jean-Yves Avenard 2015-08-13 10:58:01 +10:00
Родитель 5423815a23
Коммит 4775a405d3
2 изменённых файлов: 4 добавлений и 4 удалений

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

@ -345,7 +345,7 @@ MP3TrackDemuxer::GetEvictionOffset(TimeUnit aTime) {
int64_t
MP3TrackDemuxer::StreamLength() const {
return mSource->GetLength();
return mSource.GetLength();
}
TimeUnit
@ -525,8 +525,8 @@ MP3TrackDemuxer::Read(uint8_t* aBuffer, int64_t aOffset, int32_t aSize) {
uint32_t read = 0;
MP3DEMUXER_LOGV("MP3TrackDemuxer::Read -> ReadAt(%d)", aSize);
const nsresult rv = mSource->ReadAt(aOffset, reinterpret_cast<char*>(aBuffer),
static_cast<uint32_t>(aSize), &read);
const nsresult rv = mSource.ReadAt(aOffset, reinterpret_cast<char*>(aBuffer),
static_cast<uint32_t>(aSize), &read);
NS_ENSURE_SUCCESS(rv, 0);
return static_cast<int32_t>(read);
}

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

@ -377,7 +377,7 @@ private:
double AverageFrameLength() const;
// The (hopefully) MPEG resource.
nsRefPtr<MediaResource> mSource;
MediaResourceIndex mSource;
// MPEG frame parser used to detect frames and extract side info.
FrameParser mParser;