DescriptionFix start/stop of html5 audio stream and race condition when pausing.
(a) Update earliest time when html5 audio can end, thus fixing problem
when the stream was being truncated too early,
(b) Set length of data in buffer, so polling code used for several first
buffers can stop waiting the moment data is ready,
(c) Fix zeroing out end of buffer in partially filled buffer -- code was zeroing
correct number of bytes, but at the beginning of buffer, not at the end.
Lot of thanks to Shijing for identifying the issue, I heard that something is
wrong but could not figure out exact cause.
(d) Zero length of data in buffer when AudioDevice receives 'pause' command,
thus work around race condition when one thread pausing the playback and other
simultaneously asks for more data -- depending on exact timing buffer could
be left in the unpredictable state, resulting in the next call for data getting
extra buffer of silence (not fatal, but very noticeable when repeatedly playing
short audio stream).
(e) Remove pre-rendering of first buffer, it is not necessary for <audio>,
WebAudio (confirmed by Chris), and WebRTC (confirmed by Shijing).
WebRTC/WebAudio changes are actually no-op, as their renderers now just return
'I've filled the entire buffer'.
Note: that CL fixes html5 audio playback of short streams. It is possible to further
improve the code and maybe get rid of storing length of data in the buffer by changing
the way AudioRendererBase::FillBuffer() signals end of playback. Right now it is
synchronous, done only when host asks for more data, we probably can make it
asynchronous, by issuing delayed task into the child process IO message loop,
but that should be separate CL.
TEST=Please load the page http://www.corp.google.com/~tommi/average.html and listen.
TEST=I'll add layout test that verifies that timing is reasonable, but it will take
TEST=some time to add.
Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=115253
Patch Set 1 #Patch Set 2 : '' #
Total comments: 4
Patch Set 3 : '' #Patch Set 4 : '' #Patch Set 5 : '' #Patch Set 6 : '' #
Total comments: 6
Patch Set 7 : '' #
Total comments: 10
Patch Set 8 : '' #
Messages
Total messages: 20 (0 generated)
|