| 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" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 std::string* l) { | 55 std::string* l) { |
| 56 l->append(base::StringPrintf("<AudioParameters>")); | 56 l->append(base::StringPrintf("<AudioParameters>")); |
| 57 } | 57 } |
| 58 | 58 |
| 59 void ParamTraits<VideoCaptureFormat>::Write(Message* m, | 59 void ParamTraits<VideoCaptureFormat>::Write(Message* m, |
| 60 const VideoCaptureFormat& p) { | 60 const VideoCaptureFormat& p) { |
| 61 // Crash during Send rather than have a failure at the message handler. | 61 // Crash during Send rather than have a failure at the message handler. |
| 62 m->WriteInt(p.frame_size.width()); | 62 m->WriteInt(p.frame_size.width()); |
| 63 m->WriteInt(p.frame_size.height()); | 63 m->WriteInt(p.frame_size.height()); |
| 64 m->WriteFloat(p.frame_rate); | 64 m->WriteFloat(p.frame_rate); |
| 65 m->WriteInt(p.number_of_dropped_frames); |
| 65 m->WriteInt(static_cast<int>(p.pixel_format)); | 66 m->WriteInt(static_cast<int>(p.pixel_format)); |
| 66 } | 67 } |
| 67 | 68 |
| 68 bool ParamTraits<VideoCaptureFormat>::Read(const Message* m, | 69 bool ParamTraits<VideoCaptureFormat>::Read(const Message* m, |
| 69 PickleIterator* iter, | 70 PickleIterator* iter, |
| 70 VideoCaptureFormat* r) { | 71 VideoCaptureFormat* r) { |
| 71 int frame_size_width, frame_size_height, pixel_format; | 72 int frame_size_width, frame_size_height, pixel_format; |
| 72 if (!m->ReadInt(iter, &frame_size_width) || | 73 if (!m->ReadInt(iter, &frame_size_width) || |
| 73 !m->ReadInt(iter, &frame_size_height) || | 74 !m->ReadInt(iter, &frame_size_height) || |
| 74 !m->ReadFloat(iter, &r->frame_rate) || | 75 !m->ReadFloat(iter, &r->frame_rate) || |
| 76 !m->ReadInt(iter, &r->number_of_dropped_frames) || |
| 75 !m->ReadInt(iter, &pixel_format)) | 77 !m->ReadInt(iter, &pixel_format)) |
| 76 return false; | 78 return false; |
| 77 | 79 |
| 78 r->frame_size.SetSize(frame_size_width, frame_size_height); | 80 r->frame_size.SetSize(frame_size_width, frame_size_height); |
| 79 r->pixel_format = static_cast<VideoPixelFormat>(pixel_format); | 81 r->pixel_format = static_cast<VideoPixelFormat>(pixel_format); |
| 80 if (!r->IsValid()) | 82 if (!r->IsValid()) |
| 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 } |
| OLD | NEW |