Fixing warning C4267 on Win (more_configs).
This is a follow-up of https://webrtc-review.googlesource.com/c/src/+/12921. Bug: chromium:759980 Change-Id: Ifd39adb6541c0c7e0337f587a8b34b84a07331ed Reviewed-on: https://webrtc-review.googlesource.com/13122 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20341}
This commit is contained in:

committed by
Commit Bot

parent
117c48291c
commit
737e073f8d
@ -13,6 +13,7 @@
|
||||
#include <vector>
|
||||
|
||||
#include "api/audio_codecs/builtin_audio_encoder_factory.h"
|
||||
#include "rtc_base/safe_conversions.h"
|
||||
#include "test/gmock.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
@ -58,8 +59,8 @@ TEST_P(AudioEncoderFactoryTest, CanRunAllSupportedEncoders) {
|
||||
auto encoder = factory->MakeAudioEncoder(kTestPayloadType, spec.format);
|
||||
EXPECT_TRUE(encoder);
|
||||
encoder->Reset();
|
||||
const int num_samples =
|
||||
encoder->SampleRateHz() * encoder->NumChannels() / 100;
|
||||
const int num_samples = rtc::checked_cast<int>(
|
||||
encoder->SampleRateHz() * encoder->NumChannels() / 100);
|
||||
rtc::Buffer out;
|
||||
rtc::BufferT<int16_t> audio;
|
||||
audio.SetData(num_samples, [](rtc::ArrayView<int16_t> audio) {
|
||||
|
@ -14,6 +14,7 @@
|
||||
#include "common_audio/vad/mock/mock_vad.h"
|
||||
#include "modules/audio_coding/codecs/cng/audio_encoder_cng.h"
|
||||
#include "rtc_base/constructormagic.h"
|
||||
#include "rtc_base/safe_conversions.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/mock_audio_encoder.h"
|
||||
|
||||
@ -290,7 +291,8 @@ TEST_F(AudioEncoderCngTest, EncodePassive) {
|
||||
encoded_info_.encoded_bytes);
|
||||
EXPECT_EQ(expected_timestamp, encoded_info_.encoded_timestamp);
|
||||
}
|
||||
expected_timestamp += kBlocksPerFrame * num_audio_samples_10ms_;
|
||||
expected_timestamp += rtc::checked_cast<uint32_t>(
|
||||
kBlocksPerFrame * num_audio_samples_10ms_);
|
||||
} else {
|
||||
// Otherwise, expect no output.
|
||||
EXPECT_EQ(0u, encoded_info_.encoded_bytes);
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "modules/audio_coding/codecs/isac/main/include/audio_encoder_isac.h"
|
||||
#include "modules/audio_coding/neteq/tools/input_audio_file.h"
|
||||
#include "rtc_base/buffer.h"
|
||||
#include "rtc_base/safe_conversions.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
@ -163,10 +164,12 @@ void TestGetSetBandwidthInfo(const int16_t* speech_data,
|
||||
const int send_time = elapsed_time_ms * (sample_rate_hz / 1000);
|
||||
EXPECT_EQ(0, T::UpdateBwEstimate(
|
||||
encdec, bitstream1.data(), bitstream1.size(), i, send_time,
|
||||
channel1.Send(send_time, bitstream1.size())));
|
||||
channel1.Send(send_time,
|
||||
rtc::checked_cast<int>(bitstream1.size()))));
|
||||
EXPECT_EQ(0, T::UpdateBwEstimate(
|
||||
dec, bitstream2.data(), bitstream2.size(), i, send_time,
|
||||
channel2.Send(send_time, bitstream2.size())));
|
||||
channel2.Send(send_time,
|
||||
rtc::checked_cast<int>(bitstream2.size()))));
|
||||
|
||||
// 3. Decode, and get new BW info from the separate decoder.
|
||||
ASSERT_EQ(0, T::SetDecSampRate(encdec, sample_rate_hz));
|
||||
|
@ -10,6 +10,7 @@
|
||||
|
||||
#include "modules/audio_coding/acm2/rent_a_codec.h"
|
||||
#include "modules/audio_coding/codecs/legacy_encoded_audio_frame.h"
|
||||
#include "rtc_base/safe_conversions.h"
|
||||
#include "test/gtest.h"
|
||||
|
||||
namespace webrtc {
|
||||
@ -140,8 +141,9 @@ TEST_P(SplitBySamplesTest, PayloadSizes) {
|
||||
ASSERT_EQ(value, payload[i]);
|
||||
}
|
||||
|
||||
expected_timestamp += expected_split.frame_sizes[i] * samples_per_ms_;
|
||||
expected_byte_offset += length_bytes;
|
||||
expected_timestamp += rtc::checked_cast<uint32_t>(
|
||||
expected_split.frame_sizes[i] * samples_per_ms_);
|
||||
expected_byte_offset += rtc::checked_cast<uint32_t>(length_bytes);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -15,6 +15,7 @@
|
||||
#include "modules/audio_coding/codecs/opus/opus_interface.h"
|
||||
#include "modules/audio_coding/neteq/tools/audio_loop.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/safe_conversions.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/testsupport/fileutils.h"
|
||||
|
||||
@ -334,7 +335,7 @@ void OpusTest::TestCbrEffect(bool cbr, int block_length_ms) {
|
||||
int32_t diff = std::abs((int32_t)encoded_bytes_ - prev_pkt_size);
|
||||
max_pkt_size_diff = std::max(max_pkt_size_diff, diff);
|
||||
}
|
||||
prev_pkt_size = encoded_bytes_;
|
||||
prev_pkt_size = rtc::checked_cast<int32_t>(encoded_bytes_);
|
||||
}
|
||||
|
||||
if (cbr) {
|
||||
@ -736,7 +737,9 @@ TEST_P(OpusTest, OpusDecodeRepacketized) {
|
||||
WebRtcOpus_Encode(opus_encoder_, speech_block.data(),
|
||||
rtc::CheckedDivExact(speech_block.size(), channels_),
|
||||
kMaxBytes, bitstream_);
|
||||
if (opus_repacketizer_cat(rp, bitstream_, encoded_bytes_) == OPUS_OK) {
|
||||
if (opus_repacketizer_cat(
|
||||
rp, bitstream_,
|
||||
rtc::checked_cast<opus_int32>(encoded_bytes_)) == OPUS_OK) {
|
||||
++num_packets;
|
||||
if (num_packets == kPackets) {
|
||||
break;
|
||||
|
@ -13,6 +13,7 @@
|
||||
|
||||
#include "modules/audio_coding/codecs/red/audio_encoder_copy_red.h"
|
||||
#include "rtc_base/checks.h"
|
||||
#include "rtc_base/safe_conversions.h"
|
||||
#include "test/gtest.h"
|
||||
#include "test/mock_audio_encoder.h"
|
||||
|
||||
@ -59,7 +60,7 @@ class AudioEncoderCopyRedTest : public ::testing::Test {
|
||||
timestamp_,
|
||||
rtc::ArrayView<const int16_t>(audio_, num_audio_samples_10ms),
|
||||
&encoded_);
|
||||
timestamp_ += num_audio_samples_10ms;
|
||||
timestamp_ += rtc::checked_cast<uint32_t>(num_audio_samples_10ms);
|
||||
}
|
||||
|
||||
MockAudioEncoder* mock_encoder_;
|
||||
|
Reference in New Issue
Block a user