WebRtcVoiceEngineTest: Changed a static_cast to a checked_cast.

Also two spelling fixes.
This is a follow-up to https://codereview.webrtc.org/2669583002/

TBR=kwiberg@webrtc.org
BUG=webrtc:5806

Review-Url: https://codereview.webrtc.org/2697453004
Cr-Commit-Position: refs/heads/master@{#16586}
This commit is contained in:
ossu 2017-02-13 07:04:05 -08:00 committed by Commit bot
parent 3ad1a5065c
commit bcd88dbc01
2 changed files with 5 additions and 4 deletions

View File

@ -14,6 +14,7 @@
#include "webrtc/base/arraysize.h"
#include "webrtc/base/byteorder.h"
#include "webrtc/base/gunit.h"
#include "webrtc/base/safe_conversions.h"
#include "webrtc/call/call.h"
#include "webrtc/logging/rtc_event_log/rtc_event_log.h"
#include "webrtc/media/base/fakemediaengine.h"
@ -3724,7 +3725,7 @@ TEST(WebRtcVoiceEngineTest, CollectRecvCodecs) {
}
// Find the index of a codec, or -1 if not found, so that we can easily check
// supplementary codecs are orderd after the general codecs.
// supplementary codecs are ordered after the general codecs.
auto find_codec =
[&codecs](const webrtc::SdpAudioFormat& format) -> int {
for (size_t i = 0; i != codecs.size(); ++i) {
@ -3732,7 +3733,7 @@ TEST(WebRtcVoiceEngineTest, CollectRecvCodecs) {
if (STR_CASE_CMP(codec.name.c_str(), format.name.c_str()) == 0 &&
codec.clockrate == format.clockrate_hz &&
codec.channels == format.num_channels) {
return static_cast<int>(i);
return rtc::checked_cast<int>(i);
}
}
return -1;

View File

@ -175,8 +175,8 @@ NamedDecoderConstructor decoder_constructors[] = {
class BuiltinAudioDecoderFactory : public AudioDecoderFactory {
public:
std::vector<AudioCodecSpec> GetSupportedDecoders() override {
// Although this looks a bit strange, it means specs need only be initalized
// once, and that that initialization is thread-safe.
// Although this looks a bit strange, it means specs need only be
// initialized once, and that that initialization is thread-safe.
static std::vector<AudioCodecSpec> specs = [] {
std::vector<AudioCodecSpec> specs;
#ifdef WEBRTC_CODEC_OPUS