diff --git a/starboard/shared/starboard/player/filter/audio_channel_layout_mixer_impl.cc b/starboard/shared/starboard/player/filter/audio_channel_layout_mixer_impl.cc index 0f09fa0da62e2..df1a8894ab03f 100644 --- a/starboard/shared/starboard/player/filter/audio_channel_layout_mixer_impl.cc +++ b/starboard/shared/starboard/player/filter/audio_channel_layout_mixer_impl.cc @@ -14,6 +14,7 @@ #include "starboard/shared/starboard/player/filter/audio_channel_layout_mixer.h" +#include #include #include "starboard/common/log.h" @@ -213,11 +214,11 @@ float ClipSample(float sample) { template <> int16_t ClipSample(float sample) { - if (sample > kSbInt16Max) { - return kSbInt16Max; + if (sample > std::numeric_limits::max()) { + return std::numeric_limits::max(); } - if (sample < kSbInt16Min) { - return kSbInt16Min; + if (sample < std::numeric_limits::min()) { + return std::numeric_limits::min(); } return sample; } diff --git a/starboard/shared/starboard/player/filter/testing/audio_channel_layout_mixer_test.cc b/starboard/shared/starboard/player/filter/testing/audio_channel_layout_mixer_test.cc index 2c9b4e512f112..d5e51f37c9cc8 100644 --- a/starboard/shared/starboard/player/filter/testing/audio_channel_layout_mixer_test.cc +++ b/starboard/shared/starboard/player/filter/testing/audio_channel_layout_mixer_test.cc @@ -16,6 +16,7 @@ #include #include +#include #include #include @@ -104,7 +105,8 @@ class AudioChannelLayoutMixerTest if (storage_type_ == kSbMediaAudioFrameStorageTypePlanar) { src_index = i % kInputFrames * num_of_channels + i / kInputFrames; } - dest_buffer[i] = data_buffer[src_index] * kSbInt16Max; + dest_buffer[i] = + data_buffer[src_index] * std::numeric_limits::max(); } } return decoded_audio; @@ -146,10 +148,11 @@ class AudioChannelLayoutMixerTest src_index = i % output->frames() * output_num_of_channels + i / output->frames(); } - ASSERT_LE(fabs(expected_output[src_index] - - static_cast(output_buffer[i]) / - static_cast(kSbInt16Max)), - 0.001f); + ASSERT_LE( + fabs(expected_output[src_index] - + static_cast(output_buffer[i]) / + static_cast(std::numeric_limits::max())), + 0.001f); } } } diff --git a/starboard/types.h b/starboard/types.h index f8af0615249bf..70f3e1dfe22c2 100644 --- a/starboard/types.h +++ b/starboard/types.h @@ -57,10 +57,6 @@ typedef int64_t ssize_t; // Simulate needed portions of limits.h for platforms that don't provide it. -static const int16_t kSbInt16Min = ((int16_t)0x8000); -static const int16_t kSbInt16Max = ((int16_t)0x7FFF); -static const uint16_t kSbUInt16Max = ((uint16_t)0xFFFF); - #define kSbInt32Min ((int32_t)0x80000000) static const int32_t kSbInt32Max = ((int32_t)0x7FFFFFFF); static const uint32_t kSbUInt32Max = ((uint32_t)0xFFFFFFFF);