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

Side by Side Diff: webrtc/modules/audio_processing/include/audio_processing.h

Issue 2335483003: Replace a DCHECK with static_assert (Closed)
Patch Set: Created 4 years, 3 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) 2012 The WebRTC project authors. All Rights Reserved. 2 * Copyright (c) 2012 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
(...skipping 480 matching lines...) Expand 10 before | Expand all | Expand 10 after
491 kBadStreamParameterWarning = -13 491 kBadStreamParameterWarning = -13
492 }; 492 };
493 493
494 enum NativeRate { 494 enum NativeRate {
495 kSampleRate8kHz = 8000, 495 kSampleRate8kHz = 8000,
496 kSampleRate16kHz = 16000, 496 kSampleRate16kHz = 16000,
497 kSampleRate32kHz = 32000, 497 kSampleRate32kHz = 32000,
498 kSampleRate48kHz = 48000 498 kSampleRate48kHz = 48000
499 }; 499 };
500 500
501 static const int kNativeSampleRatesHz[]; 501 // TODO(kwiberg): We currently need to support a compiler (Visual C++) that
502 static const size_t kNumNativeSampleRates; 502 // complains if we don't explicitly state the size of the array here. Remove
503 static const int kMaxNativeSampleRateHz; 503 // the size when that's no longer the case.
504 static constexpr int kNativeSampleRatesHz[4] = {
505 kSampleRate8kHz, kSampleRate16kHz, kSampleRate32kHz, kSampleRate48kHz};
506 static constexpr size_t kNumNativeSampleRates =
507 arraysize(kNativeSampleRatesHz);
508 static constexpr int kMaxNativeSampleRateHz =
509 kNativeSampleRatesHz[kNumNativeSampleRates - 1];
504 510
505 static const int kChunkSizeMs = 10; 511 static const int kChunkSizeMs = 10;
506 }; 512 };
507 513
508 class StreamConfig { 514 class StreamConfig {
509 public: 515 public:
510 // sample_rate_hz: The sampling rate of the stream. 516 // sample_rate_hz: The sampling rate of the stream.
511 // 517 //
512 // num_channels: The number of audio channels in the stream, excluding the 518 // num_channels: The number of audio channels in the stream, excluding the
513 // keyboard channel if it is present. When passing a 519 // keyboard channel if it is present. When passing a
(...skipping 460 matching lines...) Expand 10 before | Expand all | Expand 10 after
974 // This does not impact the size of frames passed to |ProcessStream()|. 980 // This does not impact the size of frames passed to |ProcessStream()|.
975 virtual int set_frame_size_ms(int size) = 0; 981 virtual int set_frame_size_ms(int size) = 0;
976 virtual int frame_size_ms() const = 0; 982 virtual int frame_size_ms() const = 0;
977 983
978 protected: 984 protected:
979 virtual ~VoiceDetection() {} 985 virtual ~VoiceDetection() {}
980 }; 986 };
981 } // namespace webrtc 987 } // namespace webrtc
982 988
983 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_ 989 #endif // WEBRTC_MODULES_AUDIO_PROCESSING_INCLUDE_AUDIO_PROCESSING_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698