Updated TranscodingDataStream to be more gapless friendly.

This commit is contained in:
casey langen 2017-11-21 00:32:59 -08:00
parent 3e3af3c6d2
commit e85f40bdec

View File

@ -189,6 +189,7 @@ PositionType TranscodingDataStream::Read(void *buffer, PositionType bytesToRead)
lame_set_VBR(lame, vbr_off);
lame_set_VBR_mean_bitrate_kbps(lame, this->bitrate);
lame_set_out_samplerate(lame, this->pcmBuffer->SampleRate());
lame_set_bWriteVbrTag(lame, 1);
lame_init_params(lame);
}
}
@ -323,11 +324,13 @@ PositionType TranscodingDataStream::Read(void *buffer, PositionType bytesToRead)
encodedBytes.realloc(7200);
}
int count = lame_encode_flush(
int count = lame_encode_flush_nogap(
lame,
encodedBytes.data,
encodedBytes.length);
lame_init_bitstream(lame); /* writes XING header for gapless playback */
this->eof = true;
if (count >= 0) {