Protect AudioRendererAlgorithm from invalid step sizes.

BUG=165430
TEST=unittests and asan pass.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@173249 0039d316-1c4b-4281-b951-d872f2087c98
void AudioRendererAlgorithm::CrossfadeFrame(
    uint8* outtro_bytes, const uint8* intro_bytes) {
  Type* outtro = reinterpret_cast<Type*>(outtro_bytes);
  const Type* intro = reinterpret_cast<const Type*>(intro_bytes);

  int frames_in_crossfade = bytes_in_crossfade_ / bytes_per_frame_;
  float crossfade_ratio =
      static_cast<float>(crossfade_frame_number_) / frames_in_crossfade;
  for (int channel = 0; channel < channels_; ++channel) {
    *outtro *= 1.0 - crossfade_ratio;
    *outtro++ += (*intro++) * crossfade_ratio;
  }
  crossfade_frame_number_++;
}

void AudioRendererAlgorithm::CrossfadeFrame(
    uint8* outtro_bytes, const uint8* intro_bytes) {
  Type* outtro = reinterpret_cast<Type*>(outtro_bytes);
  const Type* intro = reinterpret_cast<const Type*>(intro_bytes);

  int frames_in_crossfade = bytes_in_crossfade_ / bytes_per_frame_;
  float crossfade_ratio =
      static_cast<float>(crossfade_frame_number_) / frames_in_crossfade;
  for (int channel = 0; channel < channels_; ++channel) {
    *outtro *= 1.0 - crossfade_ratio;
    *outtro++ += (*intro++) * crossfade_ratio;
  }
  crossfade_frame_number_++;
}
