Use the correct number of WaveOut buffers on XP...

Reverts a buffer size increase added in http://crrev.com/168111
and hacks added in http://crrev.com/169553

BUG=161307
TEST=Flash, HTML5 playback smoothly -- even in the background.

Review URL: https://chromiumcodereview.appspot.com/12155003

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@180102 0039d316-1c4b-4281-b951-d872f2087c98
parent 9c0f4039
...@@ -21,10 +21,6 @@ ...@@ -21,10 +21,6 @@
#include "media/base/limits.h" #include "media/base/limits.h"
#include "media/base/media_switches.h" #include "media/base/media_switches.h"
#if defined(OS_WIN)
#include "media/audio/win/core_audio_util_win.h"
#endif
namespace media { namespace media {
class OnMoreDataConverter class OnMoreDataConverter
...@@ -77,10 +73,6 @@ class OnMoreDataConverter ...@@ -77,10 +73,6 @@ class OnMoreDataConverter
// parameters. // parameters.
AudioConverter audio_converter_; AudioConverter audio_converter_;
// If we're using WaveOut on Windows' we always have to wait for DataReady()
// before calling |source_callback_|.
bool waveout_wait_hack_;
DISALLOW_COPY_AND_ASSIGN(OnMoreDataConverter); DISALLOW_COPY_AND_ASSIGN(OnMoreDataConverter);
}; };
...@@ -287,22 +279,10 @@ OnMoreDataConverter::OnMoreDataConverter(const AudioParameters& input_params, ...@@ -287,22 +279,10 @@ OnMoreDataConverter::OnMoreDataConverter(const AudioParameters& input_params,
: source_callback_(NULL), : source_callback_(NULL),
source_bus_(NULL), source_bus_(NULL),
input_bytes_per_second_(input_params.GetBytesPerSecond()), input_bytes_per_second_(input_params.GetBytesPerSecond()),
audio_converter_(input_params, output_params, false), audio_converter_(input_params, output_params, false) {
waveout_wait_hack_(false) {
io_ratio_ = io_ratio_ =
static_cast<double>(input_params.GetBytesPerSecond()) / static_cast<double>(input_params.GetBytesPerSecond()) /
output_params.GetBytesPerSecond(); output_params.GetBytesPerSecond();
// TODO(dalecurtis): We should require all render side clients to use a
// buffer size that's a multiple of the hardware buffer size scaled by the
// request_sample_rate / hw_sample_rate. Doing so ensures each hardware
// request for audio data results in only a single render side callback and
// would allow us to remove this hack. See http://crbug.com/162207.
#if defined(OS_WIN)
waveout_wait_hack_ =
output_params.format() == AudioParameters::AUDIO_PCM_LINEAR ||
!CoreAudioUtil::IsSupported();
#endif
} }
OnMoreDataConverter::~OnMoreDataConverter() {} OnMoreDataConverter::~OnMoreDataConverter() {}
...@@ -361,9 +341,6 @@ double OnMoreDataConverter::ProvideInput(AudioBus* dest, ...@@ -361,9 +341,6 @@ double OnMoreDataConverter::ProvideInput(AudioBus* dest,
io_ratio_ * (current_buffers_state_.total_bytes() + io_ratio_ * (current_buffers_state_.total_bytes() +
buffer_delay.InSecondsF() * input_bytes_per_second_); buffer_delay.InSecondsF() * input_bytes_per_second_);
if (waveout_wait_hack_)
source_callback_->WaitTillDataReady();
// Retrieve data from the original callback. // Retrieve data from the original callback.
int frames = source_callback_->OnMoreIOData( int frames = source_callback_->OnMoreIOData(
source_bus_, dest, new_buffers_state); source_bus_, dest, new_buffers_state);
......
...@@ -177,7 +177,7 @@ size_t GetAudioHardwareBufferSize() { ...@@ -177,7 +177,7 @@ size_t GetAudioHardwareBufferSize() {
return 128; return 128;
#elif defined(OS_WIN) #elif defined(OS_WIN)
// Buffer size to use when a proper size can't be determined from the system. // Buffer size to use when a proper size can't be determined from the system.
static const int kFallbackBufferSize = 4096; static const int kFallbackBufferSize = 2048;
if (!CoreAudioUtil::IsSupported()) { if (!CoreAudioUtil::IsSupported()) {
// Fall back to Windows Wave implementation on Windows XP or lower // Fall back to Windows Wave implementation on Windows XP or lower
......
...@@ -288,7 +288,8 @@ AudioOutputStream* AudioManagerWin::MakeLowLatencyOutputStream( ...@@ -288,7 +288,8 @@ AudioOutputStream* AudioManagerWin::MakeLowLatencyOutputStream(
if (!CoreAudioUtil::IsSupported()) { if (!CoreAudioUtil::IsSupported()) {
// Fall back to Windows Wave implementation on Windows XP or lower. // Fall back to Windows Wave implementation on Windows XP or lower.
DVLOG(1) << "Using WaveOut since WASAPI requires at least Vista."; DVLOG(1) << "Using WaveOut since WASAPI requires at least Vista.";
return new PCMWaveOutAudioOutputStream(this, params, 2, WAVE_MAPPER); return new PCMWaveOutAudioOutputStream(
this, params, media::NumberOfWaveOutBuffers(), WAVE_MAPPER);
} }
// TODO(henrika): remove once we properly handle input device selection. // TODO(henrika): remove once we properly handle input device selection.
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment