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

Side by Side Diff: content/common/media/audio_param_traits.cc

Issue 11647012: Improve validation when creating audio streams. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years 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 | Annotate | Revision Log
« no previous file with comments | « content/browser/renderer_host/media/audio_renderer_host.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "content/common/media/audio_param_traits.h" 5 #include "content/common/media/audio_param_traits.h"
6 6
7 #include "base/stringprintf.h" 7 #include "base/stringprintf.h"
8 #include "media/audio/audio_parameters.h" 8 #include "media/audio/audio_parameters.h"
9 9
10 using media::AudioParameters; 10 using media::AudioParameters;
(...skipping 20 matching lines...) Expand all
31 if (!m->ReadInt(iter, &format) || 31 if (!m->ReadInt(iter, &format) ||
32 !m->ReadInt(iter, &channel_layout) || 32 !m->ReadInt(iter, &channel_layout) ||
33 !m->ReadInt(iter, &sample_rate) || 33 !m->ReadInt(iter, &sample_rate) ||
34 !m->ReadInt(iter, &bits_per_sample) || 34 !m->ReadInt(iter, &bits_per_sample) ||
35 !m->ReadInt(iter, &frames_per_buffer) || 35 !m->ReadInt(iter, &frames_per_buffer) ||
36 !m->ReadInt(iter, &channels)) 36 !m->ReadInt(iter, &channels))
37 return false; 37 return false;
38 r->Reset(static_cast<AudioParameters::Format>(format), 38 r->Reset(static_cast<AudioParameters::Format>(format),
39 static_cast<ChannelLayout>(channel_layout), 39 static_cast<ChannelLayout>(channel_layout),
40 sample_rate, bits_per_sample, frames_per_buffer); 40 sample_rate, bits_per_sample, frames_per_buffer);
41 if (!r->IsValid())
42 return false;
41 return true; 43 return true;
42 } 44 }
43 45
44 void ParamTraits<AudioParameters>::Log(const AudioParameters& p, 46 void ParamTraits<AudioParameters>::Log(const AudioParameters& p,
45 std::string* l) { 47 std::string* l) {
46 l->append(base::StringPrintf("<AudioParameters>")); 48 l->append(base::StringPrintf("<AudioParameters>"));
47 } 49 }
48 50
49 } 51 }
OLDNEW
« no previous file with comments | « content/browser/renderer_host/media/audio_renderer_host.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698