Switch AudioRendererAlgorithm to buffer based on time.
commit6bf5bc1cde021e9b25dc3c6d342d7a96a79402f7
authordalecurtis <dalecurtis@chromium.org>
Thu, 13 Aug 2015 21:33:19 +0000 (13 14:33 -0700)
committerCommit bot <commit-bot@chromium.org>
Thu, 13 Aug 2015 21:33:58 +0000 (13 21:33 +0000)
tree981bb91ae4738b593d5447bc7720a8c8fceb678e
parent9b16970b9f3b8b28054d32b15099bffe55ec1722
Switch AudioRendererAlgorithm to buffer based on time.

It doesn't make sense to buffer based on a frame count when the
amount of time that data represent varies with sample rate; it's
the opposite of what we want.  I.e., a 48kHz playback will exhaust
this buffer faster than a 44.1kHz playback.

Instead, switch to time based initial capacity using the sample
rate provided during initialization.  This provides a greater
resilience against underflow when video decoding is overloading
the media thread.

At 48kHz we were previously buffering ~171ms and at 44.1kHz we were
buffering ~186ms of audio data.  I've chosen a nice round 200ms for
simplicity and since it works well on an Android One device.

BUG=519108
TEST=media_unittests still pass.

Review URL: https://codereview.chromium.org/1278733004

Cr-Commit-Position: refs/heads/master@{#343279}
media/filters/audio_renderer_algorithm.cc
media/filters/audio_renderer_algorithm.h
media/filters/audio_renderer_algorithm_unittest.cc