method private get_frame ab =
Tutils.mutexify generator_lock (fun () ->
buffering <- false ;
if should_fail then begin
self#log#f 4 "Performing skip." ;
should_fail <- false ;
if empty_on_abort then Generator.clear generator ;
Frame.add_break ab (Frame.position ab)
end else begin
Generator.fill generator ab ;
(* Currently, we don't enter the buffering phase between tracks
* even when there's not enough data in the buffer. This is mostly
* historical because there was initially no breaks in generators.
* This may sometimes be better to do it (to avoid a lag breaking
* the new track) but not always (a total disconnection should cause
* the start of a new track anyway, since the content after it
* has nothing to do with the content before the connection). *)
if Frame.is_partial ab then
self#log#f 4 "End of track." ;
if Generator.length generator = 0 then begin
self#log#f 4 "Buffer emptied, buffering needed." ;
buffering <- true
end
end) ()