Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(114)

Issue 8909006: Fix start/stop of html5 audio stream and race condition when pausing. (Closed)

Created:
9 years ago by enal
Modified:
9 years ago
CC:
chromium-reviews, hclam+watch_chromium.org, ddorwin+watch_chromium.org, fischman+watch_chromium.org, jam, acolwell+watch_chromium.org, annacc+watch_chromium.org, dpranke-watch+content_chromium.org, joi+watch-content_chromium.org, darin-cc_chromium.org, vrk (LEFT CHROMIUM), scherkus (not reviewing), ihf+watch_chromium.org
Visibility:
Public.

Description

Fix 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 : '' #

Unified diffs Side-by-side diffs Delta from patch set Stats (+55 lines, -32 lines) Patch
M content/renderer/media/audio_device.h View 1 2 3 4 5 6 7 2 chunks +14 lines, -7 lines 0 comments Download
M content/renderer/media/audio_device.cc View 1 2 3 4 5 6 7 3 chunks +16 lines, -7 lines 0 comments Download
M content/renderer/media/audio_renderer_impl.h View 1 2 3 1 chunk +3 lines, -3 lines 0 comments Download
M content/renderer/media/audio_renderer_impl.cc View 1 2 3 3 chunks +9 lines, -5 lines 0 comments Download
M content/renderer/media/webrtc_audio_device_impl.h View 2 chunks +4 lines, -3 lines 0 comments Download
M content/renderer/media/webrtc_audio_device_impl.cc View 2 chunks +2 lines, -1 line 0 comments Download
M content/renderer/renderer_webaudiodevice_impl.h View 1 chunk +3 lines, -3 lines 0 comments Download
M content/renderer/renderer_webaudiodevice_impl.cc View 1 2 chunks +4 lines, -3 lines 0 comments Download

Messages

Total messages: 20 (0 generated)
Chris Rogers
Hi Eugene, thanks very much for doing this. I just had a quick look and ...
9 years ago (2011-12-14 20:48:35 UTC) #1
enal1
On 2011/12/14 20:48:35, Chris Rogers wrote: > Hi Eugene, thanks very much for doing this. ...
9 years ago (2011-12-14 21:03:40 UTC) #2
enal1
Sending for official review. Addressed comments and got rid of pre-rendering of first buffer per ...
9 years ago (2011-12-14 22:14:53 UTC) #3
Chris Rogers
Looks pretty good. I have a couple of comment nits http://codereview.chromium.org/8909006/diff/2018/content/renderer/media/audio_device.h File content/renderer/media/audio_device.h (right): http://codereview.chromium.org/8909006/diff/2018/content/renderer/media/audio_device.h#newcode86 ...
9 years ago (2011-12-15 00:32:52 UTC) #4
enal1
Addressed everything. http://codereview.chromium.org/8909006/diff/2018/content/renderer/media/audio_device.h File content/renderer/media/audio_device.h (right): http://codereview.chromium.org/8909006/diff/2018/content/renderer/media/audio_device.h#newcode86 content/renderer/media/audio_device.h:86: // of the shared memory (i.e. buffer), ...
9 years ago (2011-12-15 16:54:40 UTC) #5
Chris Rogers
+henrika, xians for final sanity check LGTM This shouldn't change normal operation of AudioDevice clients, ...
9 years ago (2011-12-15 21:05:25 UTC) #6
henrika (OOO until Aug 14)
LGTM (with nits). We will run some tests as well on out side and come ...
9 years ago (2011-12-16 10:52:05 UTC) #7
henrika (OOO until Aug 14)
http://codereview.chromium.org/8909006/diff/8001/content/renderer/media/audio_device.cc File content/renderer/media/audio_device.cc (right): http://codereview.chromium.org/8909006/diff/8001/content/renderer/media/audio_device.cc#newcode311 content/renderer/media/audio_device.cc:311: // Let the host know we are done. Shouldn't ...
9 years ago (2011-12-16 10:52:16 UTC) #8
no longer working on chromium
http://codereview.chromium.org/8909006/diff/8001/content/renderer/media/audio_device.cc File content/renderer/media/audio_device.cc (right): http://codereview.chromium.org/8909006/diff/8001/content/renderer/media/audio_device.cc#newcode291 content/renderer/media/audio_device.cc:291: base::SyncSocket socket(socket_handle_); I am actually thinking about the opposite ...
9 years ago (2011-12-16 12:21:13 UTC) #9
enal1
Run content_unittests. Inserted blank lines before comments, replied to other comments... http://codereview.chromium.org/8909006/diff/8001/content/renderer/media/audio_device.cc File content/renderer/media/audio_device.cc (right): ...
9 years ago (2011-12-16 16:48:20 UTC) #10
no longer working on chromium
Regarding to the pre buffer: For the first doplay(), dataready() returns true because of the ...
9 years ago (2011-12-16 17:46:04 UTC) #11
enal1
> Regarding to the pre buffer:> For the first doplay(), dataready() returns true because of ...
9 years ago (2011-12-16 18:05:25 UTC) #12
commit-bot: I haz the power
No LGTM from valid reviewers yet.
9 years ago (2011-12-16 18:09:16 UTC) #13
enal1
On 2011/12/16 18:09:16, I haz the power (commit-bot) wrote: > No LGTM from valid reviewers ...
9 years ago (2011-12-16 18:12:49 UTC) #14
tommi (sloooow) - chröme
oops, sorry. Rubber stamp lgtm On Dec 16, 2011 7:12 PM, <enal@google.com> wrote: > On ...
9 years ago (2011-12-16 22:51:31 UTC) #15
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/enal@chromium.org/8909006/13003
9 years ago (2011-12-17 01:26:46 UTC) #16
commit-bot: I haz the power
Presubmit check for 8909006-13003 failed and returned exit status 1. Running presubmit commit checks ...
9 years ago (2011-12-17 01:26:52 UTC) #17
Avi (use Gerrit)
owner rubberstamp LGTM
9 years ago (2011-12-20 23:01:59 UTC) #18
commit-bot: I haz the power
CQ is trying da patch. Follow status at https://chromium-status.appspot.com/cq/enal@chromium.org/8909006/13003
9 years ago (2011-12-20 23:51:41 UTC) #19
commit-bot: I haz the power
9 years ago (2011-12-21 01:27:05 UTC) #20
Change committed as 115253

Powered by Google App Engine
This is Rietveld 408576698