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

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

Issue 509893002: Revert of Remove the last piece of deprecated synchronous IO code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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
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/strings/stringprintf.h" 7 #include "base/strings/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::VideoCaptureFormat; 14 using media::VideoCaptureFormat;
15 using media::VideoPixelFormat; 15 using media::VideoPixelFormat;
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 m->WriteInt(p.effects()); 28 m->WriteInt(p.effects());
28 } 29 }
29 30
30 bool ParamTraits<AudioParameters>::Read(const Message* m, 31 bool ParamTraits<AudioParameters>::Read(const Message* m,
31 PickleIterator* iter, 32 PickleIterator* iter,
32 AudioParameters* r) { 33 AudioParameters* r) {
33 int format, channel_layout, sample_rate, bits_per_sample, 34 int format, channel_layout, sample_rate, bits_per_sample,
34 frames_per_buffer, channels, effects; 35 frames_per_buffer, channels, input_channels, effects;
35 36
36 if (!m->ReadInt(iter, &format) || 37 if (!m->ReadInt(iter, &format) ||
37 !m->ReadInt(iter, &channel_layout) || 38 !m->ReadInt(iter, &channel_layout) ||
38 !m->ReadInt(iter, &sample_rate) || 39 !m->ReadInt(iter, &sample_rate) ||
39 !m->ReadInt(iter, &bits_per_sample) || 40 !m->ReadInt(iter, &bits_per_sample) ||
40 !m->ReadInt(iter, &frames_per_buffer) || 41 !m->ReadInt(iter, &frames_per_buffer) ||
41 !m->ReadInt(iter, &channels) || 42 !m->ReadInt(iter, &channels) ||
43 !m->ReadInt(iter, &input_channels) ||
42 !m->ReadInt(iter, &effects)) 44 !m->ReadInt(iter, &effects))
43 return false; 45 return false;
44
45 AudioParameters params(static_cast<AudioParameters::Format>(format), 46 AudioParameters params(static_cast<AudioParameters::Format>(format),
46 static_cast<ChannelLayout>(channel_layout), channels, 47 static_cast<ChannelLayout>(channel_layout), channels,
47 sample_rate, bits_per_sample, frames_per_buffer, effects); 48 input_channels, sample_rate, bits_per_sample, frames_per_buffer,
49 effects);
48 *r = params; 50 *r = params;
49 if (!r->IsValid()) 51 if (!r->IsValid())
50 return false; 52 return false;
51 return true; 53 return true;
52 } 54 }
53 55
54 void ParamTraits<AudioParameters>::Log(const AudioParameters& p, 56 void ParamTraits<AudioParameters>::Log(const AudioParameters& p,
55 std::string* l) { 57 std::string* l) {
56 l->append(base::StringPrintf("<AudioParameters>")); 58 l->append(base::StringPrintf("<AudioParameters>"));
57 } 59 }
(...skipping 23 matching lines...) Expand all
81 return false; 83 return false;
82 return true; 84 return true;
83 } 85 }
84 86
85 void ParamTraits<VideoCaptureFormat>::Log(const VideoCaptureFormat& p, 87 void ParamTraits<VideoCaptureFormat>::Log(const VideoCaptureFormat& p,
86 std::string* l) { 88 std::string* l) {
87 l->append(base::StringPrintf("<VideoCaptureFormat>")); 89 l->append(base::StringPrintf("<VideoCaptureFormat>"));
88 } 90 }
89 91
90 } 92 }
OLDNEW
« no previous file with comments | « content/browser/speech/speech_recognizer_impl.cc ('k') | content/renderer/media/audio_message_filter.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698