MP3Demuxer.cpp (basilisk-2021.12.14-source.tar.xz) | : | MP3Demuxer.cpp (basilisk-2022.01.27-source.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 678 | skipping to change at line 678 | |||
// Prepare the parser for the next frame parsing session. | // Prepare the parser for the next frame parsing session. | |||
mParser.EndFrameSession(); | mParser.EndFrameSession(); | |||
} | } | |||
int32_t | int32_t | |||
MP3TrackDemuxer::Read(uint8_t* aBuffer, int64_t aOffset, int32_t aSize) { | MP3TrackDemuxer::Read(uint8_t* aBuffer, int64_t aOffset, int32_t aSize) { | |||
MP3LOGV("MP3TrackDemuxer::Read(%p %" PRId64 " %d)", aBuffer, aOffset, aSize); | MP3LOGV("MP3TrackDemuxer::Read(%p %" PRId64 " %d)", aBuffer, aOffset, aSize); | |||
const int64_t streamLen = StreamLength(); | const int64_t streamLen = StreamLength(); | |||
if (mInfo && streamLen > 0) { | if (mInfo && streamLen > 0) { | |||
uint64_t max = streamLen > aOffset ? streamLen - aOffset : 0; | ||||
// Prevent blocking reads after successful initialization. | // Prevent blocking reads after successful initialization. | |||
aSize = std::min<int64_t>(aSize, streamLen - aOffset); | aSize = std::min<int64_t>(aSize, max); | |||
} | } | |||
uint32_t read = 0; | uint32_t read = 0; | |||
MP3LOGV("MP3TrackDemuxer::Read -> ReadAt(%d)", aSize); | MP3LOGV("MP3TrackDemuxer::Read -> ReadAt(%d)", aSize); | |||
const nsresult rv = mSource.ReadAt(aOffset, reinterpret_cast<char*>(aBuffer), | const nsresult rv = mSource.ReadAt(aOffset, reinterpret_cast<char*>(aBuffer), | |||
static_cast<uint32_t>(aSize), &read); | static_cast<uint32_t>(aSize), &read); | |||
NS_ENSURE_SUCCESS(rv, 0); | NS_ENSURE_SUCCESS(rv, 0); | |||
return static_cast<int32_t>(read); | return static_cast<int32_t>(read); | |||
} | } | |||
End of changes. 2 change blocks. | ||||
1 lines changed or deleted | 2 lines changed or added |