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

Unified Diff: media/audio/audio_parameters.cc

Issue 1211273005: Use safer IPC serializations in media_param_traits.cc (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Try harder to force invalid enum values Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: media/audio/audio_parameters.cc
diff --git a/media/audio/audio_parameters.cc b/media/audio/audio_parameters.cc
index c9dcdeb7e5f6ce66db2c93c7dbd6ecb490f3db67..872413f808379b92ad460be125340d26b7735c6a 100644
--- a/media/audio/audio_parameters.cc
+++ b/media/audio/audio_parameters.cc
@@ -68,12 +68,8 @@ void AudioParameters::Reset(Format format, ChannelLayout channel_layout,
}
bool AudioParameters::IsValid() const {
- return (format_ >= AUDIO_PCM_LINEAR) &&
- (format_ < AUDIO_LAST_FORMAT) &&
dcheng 2015/06/29 21:46:55 Removing these two lines causes two unit tests to
xhwang 2015/06/29 23:53:15 I agree :)
Tom Sepez 2015/06/30 15:37:07 Now that the enums are being checked by IPC itself
dcheng 2015/06/30 18:11:59 I just wanted to make sure that media code wasn't
- (channels_ > 0) &&
- (channels_ <= media::limits::kMaxChannels) &&
+ return (channels_ > 0) && (channels_ <= media::limits::kMaxChannels) &&
(channel_layout_ > CHANNEL_LAYOUT_UNSUPPORTED) &&
- (channel_layout_ <= CHANNEL_LAYOUT_MAX) &&
(sample_rate_ >= media::limits::kMinSampleRate) &&
(sample_rate_ <= media::limits::kMaxSampleRate) &&
(bits_per_sample_ > 0) &&

Powered by Google App Engine
This is Rietveld 408576698