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 <string> |
| 8 |
7 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
8 #include "media/audio/audio_parameters.h" | 10 #include "media/audio/audio_parameters.h" |
9 | 11 |
10 namespace IPC { | 12 namespace IPC { |
11 | 13 |
12 void ParamTraits<AudioParameters>::Write(Message* m, | 14 void ParamTraits<AudioParameters>::Write(Message* m, |
13 const AudioParameters& p) { | 15 const AudioParameters& p) { |
14 m->WriteInt(static_cast<int>(p.format())); | 16 m->WriteInt(static_cast<int>(p.format())); |
| 17 m->WriteBool(p.use_browser_mixer()); |
15 m->WriteInt(static_cast<int>(p.channel_layout())); | 18 m->WriteInt(static_cast<int>(p.channel_layout())); |
16 m->WriteInt(p.sample_rate()); | 19 m->WriteInt(p.sample_rate()); |
17 m->WriteInt(p.bits_per_sample()); | 20 m->WriteInt(p.bits_per_sample()); |
18 m->WriteInt(p.frames_per_buffer()); | 21 m->WriteInt(p.frames_per_buffer()); |
19 m->WriteInt(p.channels()); | 22 m->WriteInt(p.channels()); |
20 } | 23 } |
21 | 24 |
22 bool ParamTraits<AudioParameters>::Read(const Message* m, | 25 bool ParamTraits<AudioParameters>::Read(const Message* m, |
23 PickleIterator* iter, | 26 PickleIterator* iter, |
24 AudioParameters* r) { | 27 AudioParameters* r) { |
25 int format, channel_layout, sample_rate, bits_per_sample, | 28 int format, channel_layout, sample_rate, bits_per_sample, |
26 frames_per_buffer, channels; | 29 frames_per_buffer, channels; |
| 30 bool use_browser_mixer; |
27 | 31 |
28 if (!m->ReadInt(iter, &format) || | 32 if (!m->ReadInt(iter, &format) || |
| 33 !m->ReadBool(iter, &use_browser_mixer) || |
29 !m->ReadInt(iter, &channel_layout) || | 34 !m->ReadInt(iter, &channel_layout) || |
30 !m->ReadInt(iter, &sample_rate) || | 35 !m->ReadInt(iter, &sample_rate) || |
31 !m->ReadInt(iter, &bits_per_sample) || | 36 !m->ReadInt(iter, &bits_per_sample) || |
32 !m->ReadInt(iter, &frames_per_buffer) || | 37 !m->ReadInt(iter, &frames_per_buffer) || |
33 !m->ReadInt(iter, &channels)) | 38 !m->ReadInt(iter, &channels)) |
34 return false; | 39 return false; |
35 r->Reset(static_cast<AudioParameters::Format>(format), | 40 r->Reset(static_cast<AudioParameters::Format>(format), |
| 41 use_browser_mixer, |
36 static_cast<ChannelLayout>(channel_layout), | 42 static_cast<ChannelLayout>(channel_layout), |
37 sample_rate, bits_per_sample, frames_per_buffer); | 43 sample_rate, bits_per_sample, frames_per_buffer); |
38 return true; | 44 return true; |
39 } | 45 } |
40 | 46 |
41 void ParamTraits<AudioParameters>::Log(const AudioParameters& p, | 47 void ParamTraits<AudioParameters>::Log(const AudioParameters& p, |
42 std::string* l) { | 48 std::string* l) { |
43 l->append(base::StringPrintf("<AudioParameters>")); | 49 l->append(base::StringPrintf("<AudioParameters>")); |
44 } | 50 } |
45 | 51 |
46 } | 52 } |
OLD | NEW |