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

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

Issue 11878032: Plumb |input_channels| all the way to AudioManager (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « content/common/media/audio_messages.h ('k') | content/renderer/media/audio_message_filter.h » ('j') | 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/media_param_traits.h" 5 #include "content/common/media/media_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 #include "media/base/limits.h" 9 #include "media/base/limits.h"
10 #include "media/video/capture/video_capture_types.h" 10 #include "media/video/capture/video_capture_types.h"
11 11
12 using media::AudioParameters; 12 using media::AudioParameters;
13 using media::ChannelLayout; 13 using media::ChannelLayout;
14 using media::VideoCaptureParams; 14 using media::VideoCaptureParams;
15 using media::VideoCaptureSessionId; 15 using media::VideoCaptureSessionId;
16 16
17 namespace IPC { 17 namespace IPC {
18 18
19 void ParamTraits<AudioParameters>::Write(Message* m, 19 void ParamTraits<AudioParameters>::Write(Message* m,
20 const AudioParameters& p) { 20 const AudioParameters& p) {
21 m->WriteInt(static_cast<int>(p.format())); 21 m->WriteInt(static_cast<int>(p.format()));
22 m->WriteInt(static_cast<int>(p.channel_layout())); 22 m->WriteInt(static_cast<int>(p.channel_layout()));
23 m->WriteInt(p.sample_rate()); 23 m->WriteInt(p.sample_rate());
24 m->WriteInt(p.bits_per_sample()); 24 m->WriteInt(p.bits_per_sample());
25 m->WriteInt(p.frames_per_buffer()); 25 m->WriteInt(p.frames_per_buffer());
26 m->WriteInt(p.channels()); 26 m->WriteInt(p.channels());
27 m->WriteInt(p.input_channels());
27 } 28 }
28 29
29 bool ParamTraits<AudioParameters>::Read(const Message* m, 30 bool ParamTraits<AudioParameters>::Read(const Message* m,
30 PickleIterator* iter, 31 PickleIterator* iter,
31 AudioParameters* r) { 32 AudioParameters* r) {
32 int format, channel_layout, sample_rate, bits_per_sample, 33 int format, channel_layout, sample_rate, bits_per_sample,
33 frames_per_buffer, channels; 34 frames_per_buffer, channels, input_channels;
34 35
35 if (!m->ReadInt(iter, &format) || 36 if (!m->ReadInt(iter, &format) ||
36 !m->ReadInt(iter, &channel_layout) || 37 !m->ReadInt(iter, &channel_layout) ||
37 !m->ReadInt(iter, &sample_rate) || 38 !m->ReadInt(iter, &sample_rate) ||
38 !m->ReadInt(iter, &bits_per_sample) || 39 !m->ReadInt(iter, &bits_per_sample) ||
39 !m->ReadInt(iter, &frames_per_buffer) || 40 !m->ReadInt(iter, &frames_per_buffer) ||
40 !m->ReadInt(iter, &channels)) 41 !m->ReadInt(iter, &channels) ||
42 !m->ReadInt(iter, &input_channels))
41 return false; 43 return false;
42 r->Reset(static_cast<AudioParameters::Format>(format), 44 r->Reset(static_cast<AudioParameters::Format>(format),
43 static_cast<ChannelLayout>(channel_layout), 45 static_cast<ChannelLayout>(channel_layout), input_channels,
44 sample_rate, bits_per_sample, frames_per_buffer); 46 sample_rate, bits_per_sample, frames_per_buffer);
45 if (!r->IsValid()) 47 if (!r->IsValid())
46 return false; 48 return false;
47 return true; 49 return true;
48 } 50 }
49 51
50 void ParamTraits<AudioParameters>::Log(const AudioParameters& p, 52 void ParamTraits<AudioParameters>::Log(const AudioParameters& p,
51 std::string* l) { 53 std::string* l) {
52 l->append(base::StringPrintf("<AudioParameters>")); 54 l->append(base::StringPrintf("<AudioParameters>"));
53 } 55 }
(...skipping 30 matching lines...) Expand all
84 86
85 return true; 87 return true;
86 } 88 }
87 89
88 void ParamTraits<VideoCaptureParams>::Log(const VideoCaptureParams& p, 90 void ParamTraits<VideoCaptureParams>::Log(const VideoCaptureParams& p,
89 std::string* l) { 91 std::string* l) {
90 l->append(base::StringPrintf("<VideoCaptureParams>")); 92 l->append(base::StringPrintf("<VideoCaptureParams>"));
91 } 93 }
92 94
93 } 95 }
OLDNEW
« no previous file with comments | « content/common/media/audio_messages.h ('k') | content/renderer/media/audio_message_filter.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698