Fixing other unsafe conversions.
The bot "Win (more_configs)" has spotted another unsafe type conversion.
This CL is a follow-up of:
- https://webrtc-review.googlesource.com/c/src/+/12921
- https://webrtc-review.googlesource.com/c/src/+/13122
- https://webrtc-review.googlesource.com/c/src/+/13622
Bug: chromium:759980
Change-Id: I9a4268e7ea938cc85376211b40767fd8465f37fd
No-Try: True
Reviewed-on: https://webrtc-review.googlesource.com/13623
Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org>
Reviewed-by: Karl Wiberg <kwiberg@webrtc.org>
Cr-Commit-Position: refs/heads/master@{#20381}
diff --git a/modules/audio_coding/neteq/neteq_impl_unittest.cc b/modules/audio_coding/neteq/neteq_impl_unittest.cc
index 53c2b3c..cade064 100644
--- a/modules/audio_coding/neteq/neteq_impl_unittest.cc
+++ b/modules/audio_coding/neteq/neteq_impl_unittest.cc
@@ -574,7 +574,7 @@
.WillOnce(DoAll(SetArrayArgument<3>(dummy_output,
dummy_output + kPayloadLengthSamples),
SetArgPointee<4>(AudioDecoder::kSpeech),
- Return(kPayloadLengthSamples)));
+ Return(rtc::checked_cast<int>(kPayloadLengthSamples))));
EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder(
&mock_decoder, NetEqDecoder::kDecoderPCM16B,
"dummy name", kPayloadType));
@@ -612,7 +612,7 @@
.WillOnce(DoAll(SetArrayArgument<3>(dummy_output,
dummy_output + kPayloadLengthSamples),
SetArgPointee<4>(AudioDecoder::kSpeech),
- Return(kPayloadLengthSamples)));
+ Return(rtc::checked_cast<int>(kPayloadLengthSamples))));
// Pull audio once.
EXPECT_EQ(NetEq::kOK, neteq_->GetAudio(&output, &muted));
@@ -715,11 +715,11 @@
EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _))
.WillRepeatedly(Return(0));
EXPECT_CALL(mock_decoder, PacketDuration(_, kPayloadLengthBytes))
- .WillRepeatedly(Return(kPayloadLengthSamples));
+ .WillRepeatedly(Return(rtc::checked_cast<int>(kPayloadLengthSamples)));
// Packed duration when asking the decoder for more CNG data (without a new
// packet).
EXPECT_CALL(mock_decoder, PacketDuration(nullptr, 0))
- .WillRepeatedly(Return(kPayloadLengthSamples));
+ .WillRepeatedly(Return(rtc::checked_cast<int>(kPayloadLengthSamples)));
// Pointee(x) verifies that first byte of the payload equals x, this makes it
// possible to verify that the correct payload is fed to Decode().
@@ -728,28 +728,28 @@
.WillOnce(DoAll(SetArrayArgument<3>(dummy_output,
dummy_output + kPayloadLengthSamples),
SetArgPointee<4>(AudioDecoder::kSpeech),
- Return(kPayloadLengthSamples)));
+ Return(rtc::checked_cast<int>(kPayloadLengthSamples))));
EXPECT_CALL(mock_decoder, DecodeInternal(Pointee(1), kPayloadLengthBytes,
kSampleRateKhz * 1000, _, _))
.WillOnce(DoAll(SetArrayArgument<3>(dummy_output,
dummy_output + kPayloadLengthSamples),
SetArgPointee<4>(AudioDecoder::kComfortNoise),
- Return(kPayloadLengthSamples)));
+ Return(rtc::checked_cast<int>(kPayloadLengthSamples))));
EXPECT_CALL(mock_decoder,
DecodeInternal(IsNull(), 0, kSampleRateKhz * 1000, _, _))
.WillOnce(DoAll(SetArrayArgument<3>(dummy_output,
dummy_output + kPayloadLengthSamples),
SetArgPointee<4>(AudioDecoder::kComfortNoise),
- Return(kPayloadLengthSamples)));
+ Return(rtc::checked_cast<int>(kPayloadLengthSamples))));
EXPECT_CALL(mock_decoder, DecodeInternal(Pointee(2), kPayloadLengthBytes,
kSampleRateKhz * 1000, _, _))
.WillOnce(DoAll(SetArrayArgument<3>(dummy_output,
dummy_output + kPayloadLengthSamples),
SetArgPointee<4>(AudioDecoder::kSpeech),
- Return(kPayloadLengthSamples)));
+ Return(rtc::checked_cast<int>(kPayloadLengthSamples))));
EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder(
&mock_decoder, NetEqDecoder::kDecoderOpus,
@@ -861,7 +861,7 @@
EXPECT_CALL(decoder,
PacketDuration(Pointee(kFirstPayloadValue), kPayloadLengthBytes))
.Times(AtLeast(1))
- .WillRepeatedly(Return(kNetEqMaxFrameSize + 1));
+ .WillRepeatedly(Return(rtc::checked_cast<int>(kNetEqMaxFrameSize + 1)));
EXPECT_CALL(decoder, DecodeInternal(Pointee(kFirstPayloadValue), _, _, _, _))
.Times(0);
@@ -878,7 +878,7 @@
EXPECT_CALL(decoder,
PacketDuration(Pointee(kSecondPayloadValue), kPayloadLengthBytes))
.Times(AtLeast(1))
- .WillRepeatedly(Return(kNetEqMaxFrameSize));
+ .WillRepeatedly(Return(rtc::checked_cast<int>(kNetEqMaxFrameSize)));
EXPECT_CALL(decoder, SampleRateHz())
.WillRepeatedly(Return(kSampleRateHz));
@@ -989,7 +989,7 @@
EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _))
.WillRepeatedly(Return(0));
EXPECT_CALL(mock_decoder, PacketDuration(_, _))
- .WillRepeatedly(Return(kPayloadLengthSamples));
+ .WillRepeatedly(Return(rtc::checked_cast<int>(kPayloadLengthSamples)));
int16_t dummy_output[kPayloadLengthSamples] = {0};
// The below expectation will make the mock decoder write
// |kPayloadLengthSamples| - 5 zeros to the output array, and mark it as
@@ -1000,7 +1000,7 @@
DoAll(SetArrayArgument<3>(dummy_output,
dummy_output + kPayloadLengthSamples - 5),
SetArgPointee<4>(AudioDecoder::kSpeech),
- Return(kPayloadLengthSamples - 5)));
+ Return(rtc::checked_cast<int>(kPayloadLengthSamples - 5))));
EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder(
&mock_decoder, NetEqDecoder::kDecoderPCM16B,
"dummy name", kPayloadType));
@@ -1056,7 +1056,7 @@
EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _))
.WillRepeatedly(Return(0));
EXPECT_CALL(mock_decoder, PacketDuration(_, _))
- .WillRepeatedly(Return(kFrameLengthSamples));
+ .WillRepeatedly(Return(rtc::checked_cast<int>(kFrameLengthSamples)));
EXPECT_CALL(mock_decoder, ErrorCode())
.WillOnce(Return(kDecoderErrorCode));
EXPECT_CALL(mock_decoder, HasDecodePlc())
@@ -1073,7 +1073,7 @@
DoAll(SetArrayArgument<3>(dummy_output,
dummy_output + kFrameLengthSamples),
SetArgPointee<4>(AudioDecoder::kSpeech),
- Return(kFrameLengthSamples)))
+ Return(rtc::checked_cast<int>(kFrameLengthSamples))))
.RetiresOnSaturation();
// Then mock decoder fails. A common reason for failure can be buffer being
@@ -1091,7 +1091,7 @@
DoAll(SetArrayArgument<3>(dummy_output,
dummy_output + kFrameLengthSamples),
SetArgPointee<4>(AudioDecoder::kSpeech),
- Return(kFrameLengthSamples)));
+ Return(rtc::checked_cast<int>(kFrameLengthSamples))));
}
EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder(
@@ -1170,7 +1170,7 @@
EXPECT_CALL(mock_decoder, IncomingPacket(_, kPayloadLengthBytes, _, _, _))
.WillRepeatedly(Return(0));
EXPECT_CALL(mock_decoder, PacketDuration(_, _))
- .WillRepeatedly(Return(kFrameLengthSamples));
+ .WillRepeatedly(Return(rtc::checked_cast<int>(kFrameLengthSamples)));
EXPECT_CALL(mock_decoder, ErrorCode())
.WillOnce(Return(kDecoderErrorCode));
int16_t dummy_output[kFrameLengthSamples] = {0};
@@ -1185,7 +1185,7 @@
DoAll(SetArrayArgument<3>(dummy_output,
dummy_output + kFrameLengthSamples),
SetArgPointee<4>(AudioDecoder::kComfortNoise),
- Return(kFrameLengthSamples)))
+ Return(rtc::checked_cast<int>(kFrameLengthSamples))))
.RetiresOnSaturation();
// Then mock decoder fails. A common reason for failure can be buffer being
@@ -1201,7 +1201,7 @@
DoAll(SetArrayArgument<3>(dummy_output,
dummy_output + kFrameLengthSamples),
SetArgPointee<4>(AudioDecoder::kComfortNoise),
- Return(kFrameLengthSamples)));
+ Return(rtc::checked_cast<int>(kFrameLengthSamples))));
}
EXPECT_EQ(NetEq::kOK, neteq_->RegisterExternalDecoder(