Otherwise, we end up discarding stream data messages, and our decode
can become corrupted, notably on Chrome.
This way, we should not lose any messages while we are waiting for
source buffer creation.
Browsers now reliably autoplay, and issuing play prematurely
can generate an error in both Firefox and Chrome.
Hence we can simply remove this call and audio seems to work fine.
Around version 45, Firefox started being very particular about the
time stamps put into the Opus stream. The time stamps from the Spice server are
somewhat irregular. They mostly arrive every 10 ms, but sometimes it is 11, or sometimes
with two time stamps the same in a row. The previous logic resulted in fuzzy and/or
distorted audio streams in Firefox in a row.
Thus, we end up with an inelegant hack. Essentially, we force every packet to have
a 10ms time delta, unless there is an obvious gap in time stream, in which case we
will resync.
This replaces logic that mitigated only the duplicated time packets.
The long term solution would appear to be 'sequence' mode, but I cannot get
Firefox to use that mode (and MDN suggests that for codecs such as VP8 with time
stamps in line, that Firefox will not accept it).
We previously had a fairly crude 'gap detection', but browsers
are largely supporting the modern buffer semantics, and we can
now rely on them to detect under runs for us.
This improves audio in Chrome while playing large videos.
The playback code first tries to access this.source_buffer and then
would check whether it's defined.
This was causing unwanted exception to be thrown in the cockpit
spice-html5 plugin.
Previously, we sent them strictly upon receipt. However, receiving
is fast; by adding in some of the processing time (i.e. queueing and
so on), we encourage the adaptive rate control to slow down.
Right now, `spice_auto.html` reads the path from query string .. and
never actually does anything with it. This should make
`spice_auth.html` respect a path parametr when given.
The work Pavel did on spice.html did not get fully transferred
into spice_auto.html; in particular, we need to append the xfer
div to the main area in order for file transfer to work.
This fixes that, and now drag + drop works in spice_auto.html.
This helps video playback do a slightly better job of keeping up
in the browser. It's not a dramatic effect, but enough to start making
video playback almost tolerable.