summaryrefslogtreecommitdiffstats
path: root/lib/rbcodec/codecs/libm4a/demux.c
diff options
context:
space:
mode:
Diffstat (limited to 'lib/rbcodec/codecs/libm4a/demux.c')
-rw-r--r--lib/rbcodec/codecs/libm4a/demux.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/lib/rbcodec/codecs/libm4a/demux.c b/lib/rbcodec/codecs/libm4a/demux.c
index 25462db030..8a424c5187 100644
--- a/lib/rbcodec/codecs/libm4a/demux.c
+++ b/lib/rbcodec/codecs/libm4a/demux.c
@@ -400,7 +400,8 @@ static bool read_chunk_stsz(qtmovie_t *qtmovie, size_t chunk_len)
}
else
{
- DEBUGF("stsz too large, ignoring it\n");
+ qtmovie->res->sample_byte_sizes_offset = stream_tell(qtmovie->stream);
+ DEBUGF("stsz too large: %u, save sample_byte_sizes_offset\n", numsizes);
}
if (size_remaining)
@@ -481,6 +482,14 @@ static bool read_chunk_stco(qtmovie_t *qtmovie, size_t chunk_len)
return false;
}
+ // Reading sample_byte_sizes data on seek can lead to additional re-buffering.
+ // So skip it if we have good enough seek accuracy via lookup_table (3000 ms)
+ if (qtmovie->res->sample_byte_sizes_offset && ci->id3->length / fit_numentries <= 3000)
+ {
+ qtmovie->res->sample_byte_sizes_offset = 0;
+ DEBUGF("lookup_table seek accuracy %ld ms, ignoring sample_byte_sizes_offset \n", ci->id3->length / fit_numentries);
+ }
+
/* Build up lookup table. The lookup table contains the sample index and
* byte position in the file for each chunk. This table is used to seek
* and resume (see m4a_seek() and m4a_seek_raw() in libm4a/m4a.c) and