ADTSDemuxer.cpp (basilisk-2021.12.14-source.tar.xz) | : | ADTSDemuxer.cpp (basilisk-2022.01.27-source.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 816 | skipping to change at line 816 | |||
MOZ_ASSERT(mFrameIndex > 0); | MOZ_ASSERT(mFrameIndex > 0); | |||
} | } | |||
int32_t | int32_t | |||
ADTSTrackDemuxer::Read(uint8_t* aBuffer, int64_t aOffset, int32_t aSize) | ADTSTrackDemuxer::Read(uint8_t* aBuffer, int64_t aOffset, int32_t aSize) | |||
{ | { | |||
ADTSLOGV("ADTSTrackDemuxer::Read(%p %" PRId64 " %d)", aBuffer, aOffset, aSize) ; | ADTSLOGV("ADTSTrackDemuxer::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) { | |||
int64_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; | |||
ADTSLOGV("ADTSTrackDemuxer::Read -> ReadAt(%d)", aSize); | ADTSLOGV("ADTSTrackDemuxer::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 |