Atrac: Clamp packets to valid data.

In case we don't have full valid data yet, return only the part of the
data that is valid.  This allows FFmpeg to decode data it already has, as
necessary.
This commit is contained in:
Unknown W. Brackets 2016-01-01 11:33:48 -08:00
parent cdca0492a4
commit dafb15d96e

View file

@ -428,12 +428,12 @@ struct Atrac {
bool FillPacket() {
u32 off = getFileOffsetBySample(currentSample);
if (off < first.filesize) {
if (off < first.size) {
#ifdef USE_FFMPEG
av_init_packet(packet);
#endif // USE_FFMPEG
packet->data = data_buf + off;
packet->size = atracBytesPerFrame;
packet->size = std::min((u32)atracBytesPerFrame, first.size - off);
packet->pos = off;
return true;