OLD | NEW |
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 Loading... |
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 } |
OLD | NEW |