mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 1120023 - Fix some bugs in MockMediaResource. r=cpearce
If we don't do this, the subsequent changes to DataSourceAdapter will cause gtest failures in TestMP4Demuxer.
This commit is contained in:
parent
ce40739fa6
commit
7f0e239ab3
@ -49,7 +49,8 @@ MockMediaResource::ReadAt(int64_t aOffset, char* aBuffer, uint32_t aCount,
|
||||
}
|
||||
|
||||
fseek(mFileHandle, aOffset, SEEK_SET);
|
||||
*aBytes = (uint32_t) fread(aBuffer, aCount, 1, mFileHandle);
|
||||
size_t objectsRead = fread(aBuffer, aCount, 1, mFileHandle);
|
||||
*aBytes = objectsRead == 1 ? aCount : 0;
|
||||
|
||||
mEntry--;
|
||||
|
||||
|
@ -59,8 +59,12 @@ public:
|
||||
virtual nsresult ReadFromCache(char* aBuffer, int64_t aOffset,
|
||||
uint32_t aCount) MOZ_OVERRIDE
|
||||
{
|
||||
return NS_OK;
|
||||
uint32_t bytesRead = 0;
|
||||
nsresult rv = ReadAt(aOffset, aBuffer, aCount, &bytesRead);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return bytesRead == aCount ? NS_OK : NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
virtual bool IsTransportSeekable() MOZ_OVERRIDE { return true; }
|
||||
virtual nsresult Open(nsIStreamListener** aStreamListener) MOZ_OVERRIDE;
|
||||
virtual nsresult GetCachedRanges(nsTArray<MediaByteRange>& aRanges)
|
||||
|
Loading…
Reference in New Issue
Block a user