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

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

Issue 1304973005: Refactor AudioParameters member setting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Cross-platform fixes. Created 5 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
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 "content/common/media/audio_messages.h" 8 #include "content/common/media/audio_messages.h"
9 #include "content/common/media/video_capture_messages.h" 9 #include "content/common/media/video_capture_messages.h"
10 #include "ipc/ipc_message_utils.h" 10 #include "ipc/ipc_message_utils.h"
(...skipping 26 matching lines...) Expand all
37 int sample_rate, bits_per_sample, frames_per_buffer, channels, effects; 37 int sample_rate, bits_per_sample, frames_per_buffer, channels, effects;
38 38
39 if (!ReadParam(m, iter, &format) || !ReadParam(m, iter, &channel_layout) || 39 if (!ReadParam(m, iter, &format) || !ReadParam(m, iter, &channel_layout) ||
40 !ReadParam(m, iter, &sample_rate) || 40 !ReadParam(m, iter, &sample_rate) ||
41 !ReadParam(m, iter, &bits_per_sample) || 41 !ReadParam(m, iter, &bits_per_sample) ||
42 !ReadParam(m, iter, &frames_per_buffer) || 42 !ReadParam(m, iter, &frames_per_buffer) ||
43 !ReadParam(m, iter, &channels) || !ReadParam(m, iter, &effects)) { 43 !ReadParam(m, iter, &channels) || !ReadParam(m, iter, &effects)) {
44 return false; 44 return false;
45 } 45 }
46 46
47 AudioParameters params(format, channel_layout, channels, sample_rate, 47 AudioParameters params(format, channel_layout, sample_rate, bits_per_sample,
48 bits_per_sample, frames_per_buffer, effects); 48 frames_per_buffer);
49 params.set_channels_for_discrete(channels);
50 params.set_effects(effects);
51
49 *r = params; 52 *r = params;
50 return r->IsValid(); 53 return r->IsValid();
51 } 54 }
52 55
53 void ParamTraits<AudioParameters>::Log(const AudioParameters& p, 56 void ParamTraits<AudioParameters>::Log(const AudioParameters& p,
54 std::string* l) { 57 std::string* l) {
55 l->append(base::StringPrintf("<AudioParameters>")); 58 l->append(base::StringPrintf("<AudioParameters>"));
56 } 59 }
57 60
58 void ParamTraits<VideoCaptureFormat>::Write(Message* m, 61 void ParamTraits<VideoCaptureFormat>::Write(Message* m,
(...skipping 15 matching lines...) Expand all
74 } 77 }
75 return r->IsValid(); 78 return r->IsValid();
76 } 79 }
77 80
78 void ParamTraits<VideoCaptureFormat>::Log(const VideoCaptureFormat& p, 81 void ParamTraits<VideoCaptureFormat>::Log(const VideoCaptureFormat& p,
79 std::string* l) { 82 std::string* l) {
80 l->append(base::StringPrintf("<VideoCaptureFormat> %s", 83 l->append(base::StringPrintf("<VideoCaptureFormat> %s",
81 media::VideoCaptureFormat::ToString(p).c_str())); 84 media::VideoCaptureFormat::ToString(p).c_str()));
82 } 85 }
83 86
84 } 87 } // namespace IPC
OLDNEW
« no previous file with comments | « content/browser/speech/speech_recognizer_impl.cc ('k') | content/renderer/media/audio_renderer_mixer_manager_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698