Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(50)

Side by Side Diff: webrtc/api/audio_codecs/L16/audio_encoder_L16.cc

Issue 3003133002: Fix an implicit narrowing conversion found by MSVC (Closed)
Patch Set: with roll Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2017 The WebRTC project authors. All Rights Reserved.
3 * 3 *
4 * Use of this source code is governed by a BSD-style license 4 * Use of this source code is governed by a BSD-style license
5 * that can be found in the LICENSE file in the root of the source 5 * that can be found in the LICENSE file in the root of the source
6 * tree. An additional intellectual property rights grant can be found 6 * tree. An additional intellectual property rights grant can be found
7 * in the file PATENTS. All contributing project authors may 7 * in the file PATENTS. All contributing project authors may
8 * be found in the AUTHORS file in the root of the source tree. 8 * be found in the AUTHORS file in the root of the source tree.
9 */ 9 */
10 10
11 #include "webrtc/api/audio_codecs/L16/audio_encoder_L16.h" 11 #include "webrtc/api/audio_codecs/L16/audio_encoder_L16.h"
12 12
13 #include "webrtc/common_types.h" 13 #include "webrtc/common_types.h"
14 #include "webrtc/modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h" 14 #include "webrtc/modules/audio_coding/codecs/pcm16b/audio_encoder_pcm16b.h"
15 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b_common.h" 15 #include "webrtc/modules/audio_coding/codecs/pcm16b/pcm16b_common.h"
16 #include "webrtc/rtc_base/ptr_util.h" 16 #include "webrtc/rtc_base/ptr_util.h"
kwiberg-webrtc 2017/08/22 20:06:05 #include safe_conversions.h here?
oprypin_webrtc 2017/08/22 20:28:39 Done in both places
17 17
18 namespace webrtc { 18 namespace webrtc {
19 19
20 rtc::Optional<AudioEncoderL16::Config> AudioEncoderL16::SdpToConfig( 20 rtc::Optional<AudioEncoderL16::Config> AudioEncoderL16::SdpToConfig(
21 const SdpAudioFormat& format) { 21 const SdpAudioFormat& format) {
22 Config config; 22 Config config;
23 config.sample_rate_hz = format.clockrate_hz; 23 config.sample_rate_hz = format.clockrate_hz;
24 config.num_channels = format.num_channels; 24 config.num_channels = rtc::checked_cast<int>(format.num_channels);
25 return STR_CASE_CMP(format.name.c_str(), "L16") == 0 && config.IsOk() 25 return STR_CASE_CMP(format.name.c_str(), "L16") == 0 && config.IsOk()
26 ? rtc::Optional<Config>(config) 26 ? rtc::Optional<Config>(config)
27 : rtc::Optional<Config>(); 27 : rtc::Optional<Config>();
28 } 28 }
29 29
30 void AudioEncoderL16::AppendSupportedEncoders( 30 void AudioEncoderL16::AppendSupportedEncoders(
31 std::vector<AudioCodecSpec>* specs) { 31 std::vector<AudioCodecSpec>* specs) {
32 Pcm16BAppendSupportedCodecSpecs(specs); 32 Pcm16BAppendSupportedCodecSpecs(specs);
33 } 33 }
34 34
(...skipping 11 matching lines...) Expand all
46 RTC_DCHECK(config.IsOk()); 46 RTC_DCHECK(config.IsOk());
47 AudioEncoderPcm16B::Config c; 47 AudioEncoderPcm16B::Config c;
48 c.sample_rate_hz = config.sample_rate_hz; 48 c.sample_rate_hz = config.sample_rate_hz;
49 c.num_channels = config.num_channels; 49 c.num_channels = config.num_channels;
50 c.frame_size_ms = config.frame_size_ms; 50 c.frame_size_ms = config.frame_size_ms;
51 c.payload_type = payload_type; 51 c.payload_type = payload_type;
52 return rtc::MakeUnique<AudioEncoderPcm16B>(c); 52 return rtc::MakeUnique<AudioEncoderPcm16B>(c);
53 } 53 }
54 54
55 } // namespace webrtc 55 } // namespace webrtc
OLDNEW
« no previous file with comments | « DEPS ('k') | webrtc/call/rtp_demuxer_unittest.cc » ('j') | webrtc/call/rtp_demuxer_unittest.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698