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

Side by Side Diff: webrtc/common_audio/wav_file.cc

Issue 1753293002: Safe numeric library: base/numerics (copied from Chromium) (Closed) Base URL: https://chromium.googlesource.com/external/webrtc.git@master
Patch Set: Rebase with master + correct new safe_conversions.h include Created 4 years, 9 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
« no previous file with comments | « webrtc/common_audio/audio_converter.cc ('k') | webrtc/media/engine/webrtcvideocapturer.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* 1 /*
2 * Copyright (c) 2014 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2014 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/common_audio/wav_file.h" 11 #include "webrtc/common_audio/wav_file.h"
12 12
13 #include <algorithm> 13 #include <algorithm>
14 #include <cstdio> 14 #include <cstdio>
15 #include <limits> 15 #include <limits>
16 #include <sstream> 16 #include <sstream>
17 17
18 #include "webrtc/base/checks.h" 18 #include "webrtc/base/checks.h"
19 #include "webrtc/base/safe_conversions.h" 19 #include "webrtc/base/numerics/safe_conversions.h"
20 #include "webrtc/common_audio/include/audio_util.h" 20 #include "webrtc/common_audio/include/audio_util.h"
21 #include "webrtc/common_audio/wav_header.h" 21 #include "webrtc/common_audio/wav_header.h"
22 22
23 namespace webrtc { 23 namespace webrtc {
24 24
25 // We write 16-bit PCM WAV files. 25 // We write 16-bit PCM WAV files.
26 static const WavFormat kWavFormat = kWavFormatPcm; 26 static const WavFormat kWavFormat = kWavFormatPcm;
27 static const size_t kBytesPerSample = 2; 27 static const size_t kBytesPerSample = 2;
28 28
29 // Doesn't take ownership of the file handle and won't close it. 29 // Doesn't take ownership of the file handle and won't close it.
(...skipping 166 matching lines...) Expand 10 before | Expand all | Expand 10 after
196 return reinterpret_cast<const webrtc::WavWriter*>(wf)->sample_rate(); 196 return reinterpret_cast<const webrtc::WavWriter*>(wf)->sample_rate();
197 } 197 }
198 198
199 size_t rtc_WavNumChannels(const rtc_WavWriter* wf) { 199 size_t rtc_WavNumChannels(const rtc_WavWriter* wf) {
200 return reinterpret_cast<const webrtc::WavWriter*>(wf)->num_channels(); 200 return reinterpret_cast<const webrtc::WavWriter*>(wf)->num_channels();
201 } 201 }
202 202
203 size_t rtc_WavNumSamples(const rtc_WavWriter* wf) { 203 size_t rtc_WavNumSamples(const rtc_WavWriter* wf) {
204 return reinterpret_cast<const webrtc::WavWriter*>(wf)->num_samples(); 204 return reinterpret_cast<const webrtc::WavWriter*>(wf)->num_samples();
205 } 205 }
OLDNEW
« no previous file with comments | « webrtc/common_audio/audio_converter.cc ('k') | webrtc/media/engine/webrtcvideocapturer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698