Chromium Code Reviews| 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/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::VideoCaptureParams; | 15 using media::VideoCaptureParams; |
| 15 using media::VideoCaptureSessionId; | 16 using media::VideoCaptureSessionId; |
| 16 | 17 |
| 17 namespace IPC { | 18 namespace IPC { |
| 18 | 19 |
| 19 void ParamTraits<AudioParameters>::Write(Message* m, | 20 void ParamTraits<AudioParameters>::Write(Message* m, |
| 20 const AudioParameters& p) { | 21 const AudioParameters& p) { |
| 21 m->WriteInt(static_cast<int>(p.format())); | 22 m->WriteInt(static_cast<int>(p.format())); |
| 22 m->WriteInt(static_cast<int>(p.channel_layout())); | 23 m->WriteInt(static_cast<int>(p.channel_layout())); |
| 23 m->WriteInt(p.sample_rate()); | 24 m->WriteInt(p.sample_rate()); |
| (...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 81 if (!r->IsValid()) | 82 if (!r->IsValid()) |
| 82 return false; | 83 return false; |
| 83 return true; | 84 return true; |
| 84 } | 85 } |
| 85 | 86 |
| 86 void ParamTraits<VideoCaptureParams>::Log(const VideoCaptureParams& p, | 87 void ParamTraits<VideoCaptureParams>::Log(const VideoCaptureParams& p, |
| 87 std::string* l) { | 88 std::string* l) { |
| 88 l->append(base::StringPrintf("<VideoCaptureParams>")); | 89 l->append(base::StringPrintf("<VideoCaptureParams>")); |
| 89 } | 90 } |
| 90 | 91 |
| 92 void ParamTraits<VideoCaptureFormat>::Write(Message* m, | |
|
Ami GONE FROM CHROMIUM
2013/10/04 00:24:15
Since this is only sent from the browser to the re
ncarter (slow)
2013/10/16 02:08:40
I shifted to something slightly different:
* Kept
| |
| 93 const VideoCaptureFormat& p) { | |
| 94 m->WriteInt(p.width); | |
| 95 m->WriteInt(p.height); | |
| 96 m->WriteInt(p.frame_rate); | |
| 97 m->WriteInt(static_cast<int>(p.frame_size_type)); | |
| 91 } | 98 } |
| 99 | |
| 100 bool ParamTraits<VideoCaptureFormat>::Read(const Message* m, | |
| 101 PickleIterator* iter, | |
| 102 VideoCaptureFormat* r) { | |
| 103 int frame_size_type; | |
| 104 if (!m->ReadInt(iter, &r->width) || | |
| 105 !m->ReadInt(iter, &r->height) || | |
| 106 !m->ReadInt(iter, &r->frame_rate) || | |
| 107 !m->ReadInt(iter, &frame_size_type)) | |
| 108 return false; | |
| 109 | |
| 110 r->frame_size_type = | |
| 111 static_cast<media::VideoCaptureResolutionType>( | |
| 112 frame_size_type); | |
| 113 if (!r->IsValid()) | |
| 114 return false; | |
| 115 return true; | |
| 116 } | |
| 117 | |
| 118 void ParamTraits<VideoCaptureFormat>::Log(const VideoCaptureFormat& p, | |
| 119 std::string* l) { | |
| 120 l->append(base::StringPrintf("<VideoCaptureFormat>")); | |
| 121 } | |
| 122 | |
| 123 } | |
| OLD | NEW |