Fixing warning C4267 on Win (more_configs).
We added a new bot to client.webrtc.fyi (https://build.chromium.org/p/client.webrtc.fyi/builders/Win%20%28more%20configs%29). It seems it is spotting some unsafe conversions and this CL is a test to see if we can use rtc::dchecked_cast to fix them: ../../modules/audio_coding/neteq/neteq_unittest.cc(547): error C2220: warning treated as error - no 'object' file generated ../../modules/audio_coding/neteq/neteq_unittest.cc(547): warning C4267: '=': conversion from 'size_t' to 'uint16_t', possible loss of data ../../modules/audio_coding/neteq/neteq_unittest.cc(548): warning C4267: '=': conversion from 'size_t' to 'uint32_t', possible loss of data ../../modules/audio_coding/neteq/neteq_unittest.cc(977): warning C4267: '+=': conversion from 'size_t' to 'uint32_t', possible loss of data ../../modules/audio_coding/neteq/neteq_unittest.cc(979): warning C4267: '+=': conversion from 'size_t' to 'uint32_t', possible loss Bug: chromium:759980 Change-Id: Icd0f32ccf620c7c6642fadff797dc2482918648d No-Try: True Reviewed-on: https://webrtc-review.googlesource.com/12921 Commit-Queue: Mirko Bonadei <mbonadei@webrtc.org> Reviewed-by: Karl Wiberg <kwiberg@webrtc.org> Cr-Commit-Position: refs/heads/master@{#20335}
This commit is contained in:
committed by
Commit Bot
parent
9ce0c7a2d2
commit
a811027990
@ -29,6 +29,7 @@
|
||||
#include "rtc_base/flags.h"
|
||||
#include "rtc_base/ignore_wundef.h"
|
||||
#include "rtc_base/protobuf_utils.h"
|
||||
#include "rtc_base/safe_conversions.h"
|
||||
#include "rtc_base/sha1digest.h"
|
||||
#include "rtc_base/stringencode.h"
|
||||
#include "test/gtest.h"
|
||||
@ -544,8 +545,8 @@ TEST_F(NetEqDecodingTestFaxMode, TestFrameWaitingTimeStatistics) {
|
||||
for (size_t i = 0; i < num_frames; ++i) {
|
||||
const uint8_t payload[kPayloadBytes] = {0};
|
||||
RTPHeader rtp_info;
|
||||
rtp_info.sequenceNumber = i;
|
||||
rtp_info.timestamp = i * kSamples;
|
||||
rtp_info.sequenceNumber = rtc::checked_cast<uint16_t>(i);
|
||||
rtp_info.timestamp = rtc::checked_cast<uint32_t>(i * kSamples);
|
||||
rtp_info.ssrc = 0x1234; // Just an arbitrary SSRC.
|
||||
rtp_info.payloadType = 94; // PCM16b WB codec.
|
||||
rtp_info.markerBit = 0;
|
||||
@ -974,9 +975,11 @@ class NetEqBgnTest : public NetEqDecodingTest {
|
||||
ASSERT_EQ(AudioFrame::kNormalSpeech, output.speech_type_);
|
||||
|
||||
// Next packet.
|
||||
rtp_info.timestamp += expected_samples_per_channel;
|
||||
rtp_info.timestamp += rtc::checked_cast<uint32_t>(
|
||||
expected_samples_per_channel);
|
||||
rtp_info.sequenceNumber++;
|
||||
receive_timestamp += expected_samples_per_channel;
|
||||
receive_timestamp += rtc::checked_cast<uint32_t>(
|
||||
expected_samples_per_channel);
|
||||
}
|
||||
|
||||
output.Reset();
|
||||
|
||||
Reference in New Issue
Block a user