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
parent 45c74a8d98
commit 7d33fa6fc6
2 changed files with 4 additions and 4 deletions

View File

@ -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);
}

View File

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