This is one of a series of commits that will make it possible to loop compressed ogg and Opus streams.
@@ -240,6 +240,9 @@ read_samples(int n, int16_t *data) {
data += read_samples * _audio_channels;
_samples_read += read_samples;
} else {
+ if (read_samples == 0 && _length == 1.0E10) {
+ _length = op_pcm_tell(_op) / 48000.0;
+ }
break;
}
@@ -158,6 +158,9 @@ read_samples(int n, int16_t *data) {
buffer += read_bytes;
length -= read_bytes;
+ if (read_bytes == 0 && _length == 1.0E10) {
+ _length = ov_time_tell(&_ov);