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

Issue 6822019: Fix erratic HTML5 audio playback (Closed)

Created:
9 years, 8 months ago by davejcool
Modified:
9 years, 7 months ago
CC:
chromium-reviews
Visibility:
Public.

Description

Fix erratic HTML5 audio playback This was affecting all platforms. The major issue was that he SetPlaybackRate(1) which is used to start playback was being done in the middle of the series of Seek operations. So doing Seek() followed by SetPlaybackRate(1) was done, the Seek could immediately stop the playback. To fix, Seek() was made atomic with regards to SetPlaybackRate() by delaying the execution of SetPlaybackRate until after the Seek sequence has completely finished. To make things run even smoother, a short delay was added before recyclilng a used audio stream in the Dispatcher. This gives the stream time to 'power down' before being reused. Tested on Linux, Chrome-OS (Cr48) and Mac with great results, making HTML5 audio much more usable for games. BUG=73045, 59369, 59370, 65618 TEST=Manual, Quickly playing/stopping HTML5 audio should play cleanly. Committed: http://src.chromium.org/viewvc/chrome?view=rev&revision=81670

Patch Set 1 #

Total comments: 9

Patch Set 2 : fixed nits #

Total comments: 4

Patch Set 3 : more fixup #

Total comments: 1

Patch Set 4 : cleanup #

Total comments: 4

Patch Set 5 : fix nit #

Unified diffs Side-by-side diffs Delta from patch set Stats (+77 lines, -21 lines) Patch
M media/audio/audio_output_dispatcher.h View 1 2 4 chunks +15 lines, -7 lines 0 comments Download
M media/audio/audio_output_dispatcher.cc View 1 2 3 4 8 chunks +39 lines, -14 lines 0 comments Download
M media/base/pipeline_impl.h View 1 2 chunks +6 lines, -0 lines 0 comments Download
M media/base/pipeline_impl.cc View 1 4 chunks +17 lines, -0 lines 0 comments Download

Messages

Total messages: 13 (0 generated)
davejcool
I'm getting very responsive real-time results playing HTML5 audio with this.
9 years, 8 months ago (2011-04-09 03:50:56 UTC) #1
Avi (use Gerrit)
http://codereview.chromium.org/6822019/diff/1/media/base/pipeline_impl.h File media/base/pipeline_impl.h (right): http://codereview.chromium.org/6822019/diff/1/media/base/pipeline_impl.h#newcode333 media/base/pipeline_impl.h:333: // Wheather or not a playback rate change should ...
9 years, 8 months ago (2011-04-09 05:35:24 UTC) #2
Sergey Ulanov
Thanks for fixing this, I like this approach. Some nits. The only serious issue is ...
9 years, 8 months ago (2011-04-09 07:02:04 UTC) #3
scherkus (not reviewing)
more nits could you add a test to pipeline_impl_unittests? http://codereview.chromium.org/6822019/diff/1/media/audio/audio_output_dispatcher.cc File media/audio/audio_output_dispatcher.cc (right): http://codereview.chromium.org/6822019/diff/1/media/audio/audio_output_dispatcher.cc#newcode72 media/audio/audio_output_dispatcher.cc:72: ...
9 years, 8 months ago (2011-04-11 22:32:33 UTC) #4
davejcool
Here's an update addressing the various nits and such.
9 years, 8 months ago (2011-04-12 02:37:41 UTC) #5
Sergey Ulanov
http://codereview.chromium.org/6822019/diff/1006/media/audio/audio_output_dispatcher.cc File media/audio/audio_output_dispatcher.cc (right): http://codereview.chromium.org/6822019/diff/1006/media/audio/audio_output_dispatcher.cc#newcode18 media/audio/audio_output_dispatcher.cc:18: pause_delay_milliseconds( 2 * params.samples_per_packet * nit: remove space before ...
9 years, 8 months ago (2011-04-12 05:09:25 UTC) #6
davejcool
I put the close_timer_.Reset() back in StreamStopped(), and it didn't need to be in the ...
9 years, 8 months ago (2011-04-12 22:54:52 UTC) #7
Sergey Ulanov
Changes in AudioOutputDispatcher LGTM. I'll leave pipeline review to Andrew. http://codereview.chromium.org/6822019/diff/7001/media/audio/audio_output_dispatcher.cc File media/audio/audio_output_dispatcher.cc (right): http://codereview.chromium.org/6822019/diff/7001/media/audio/audio_output_dispatcher.cc#newcode77 ...
9 years, 8 months ago (2011-04-13 02:02:54 UTC) #8
scherkus (not reviewing)
LGTM -- this might affect how media layout tests runs so try giving them a ...
9 years, 8 months ago (2011-04-13 16:02:01 UTC) #9
davejcool
A couple of the media unit tests were failing because of a close stream not ...
9 years, 8 months ago (2011-04-14 00:43:26 UTC) #10
scherkus (not reviewing)
thanks for making sure tests still passed! one tiny tiny style nit but this is ...
9 years, 8 months ago (2011-04-14 17:11:08 UTC) #11
Sergey Ulanov
http://codereview.chromium.org/6822019/diff/8003/media/audio/audio_output_dispatcher.cc File media/audio/audio_output_dispatcher.cc (right): http://codereview.chromium.org/6822019/diff/8003/media/audio/audio_output_dispatcher.cc#newcode92 media/audio/audio_output_dispatcher.cc:92: idle_streams_.push_back(pausing_streams_.back()); I don't like this. Basically when a single ...
9 years, 8 months ago (2011-04-14 18:05:08 UTC) #12
davejcool
9 years, 8 months ago (2011-04-15 01:12:51 UTC) #13
http://codereview.chromium.org/6822019/diff/8003/media/audio/audio_output_dis...
File media/audio/audio_output_dispatcher.cc (right):

http://codereview.chromium.org/6822019/diff/8003/media/audio/audio_output_dis...
media/audio/audio_output_dispatcher.cc:92:
idle_streams_.push_back(pausing_streams_.back());
On 2011/04/14 18:05:09, sergeyu wrote:
> I don't like this. Basically when a single stream closing, you are moving all
> other streams from pausing_streams_ to idle_streams_, so playback on other
> streams may be disrupted.
> Can we update tests to reflect new behaviour instead of cleaning
> |pausing_streams_| here?

Closing the pausing_streams_ later can not be done in the constructor because
that's not on the right thread.  Some other ideas are:
(1) If we knew what physical stream the caller was using when StreamClosed() is
called, we could just move that one only.
(2) If idle_streams_ was also a <list>, the pausing streams could be pushed to
the front, so at they'd be getting closed later than the other streams, and much
less likely to be disrupted.

Powered by Google App Engine
This is Rietveld 408576698