- Frame const end = frame + length - 1;
-
- /* If we are less than (about) 5 seconds behind the data that we want we'll
- run through it rather than seeking.
- */
- Frame const slack = 5 * 48000;
+ Frame const from = frame;
+ Frame const to = from + length;
+ Frame const have_from = _decoded.frame;
+ Frame const have_to = _decoded.frame + _decoded.audio->frames();
+
+ optional<Frame> missing;
+ if (have_from > from || have_to < to) {
+ /* We need something */
+ if (have_from < from && from < have_to) {
+ missing = have_to;
+ } else {
+ missing = from;
+ }
+ }