Chromium Code Reviews| Index: content/common/media/media_param_traits.cc |
| diff --git a/content/common/media/media_param_traits.cc b/content/common/media/media_param_traits.cc |
| index 280d908ccfc00386bb8f88217abbd6897acbe6eb..d350424b374b1ee67fa0c4b835b40ec9d1bf6bf1 100644 |
| --- a/content/common/media/media_param_traits.cc |
| +++ b/content/common/media/media_param_traits.cc |
| @@ -5,14 +5,15 @@ |
| #include "content/common/media/media_param_traits.h" |
| #include "base/strings/stringprintf.h" |
| +#include "content/common/media/video_capture_messages.h" |
|
dcheng
2015/06/25 02:00:04
This #include is needed to pull in the IPC_ENUM_TR
|
| +#include "ipc/ipc_message_utils.h" |
| #include "media/audio/audio_parameters.h" |
| #include "media/base/limits.h" |
| -#include "media/base/video_capture_types.h" |
| +#include "ui/gfx/ipc/gfx_param_traits.h" |
| using media::AudioParameters; |
| using media::ChannelLayout; |
| using media::VideoCaptureFormat; |
| -using media::VideoPixelFormat; |
| namespace IPC { |
| @@ -39,16 +40,15 @@ bool ParamTraits<AudioParameters>::Read(const Message* m, |
| !iter->ReadInt(&bits_per_sample) || |
| !iter->ReadInt(&frames_per_buffer) || |
| !iter->ReadInt(&channels) || |
| - !iter->ReadInt(&effects)) |
| + !iter->ReadInt(&effects)) { |
| return false; |
| + } |
| AudioParameters params(static_cast<AudioParameters::Format>(format), |
| static_cast<ChannelLayout>(channel_layout), channels, |
| sample_rate, bits_per_sample, frames_per_buffer, effects); |
| *r = params; |
| - if (!r->IsValid()) |
| - return false; |
| - return true; |
| + return r->IsValid(); |
| } |
| void ParamTraits<AudioParameters>::Log(const AudioParameters& p, |
| @@ -63,23 +63,19 @@ void ParamTraits<VideoCaptureFormat>::Write(Message* m, |
| m->WriteInt(p.frame_size.height()); |
| m->WriteFloat(p.frame_rate); |
| m->WriteInt(static_cast<int>(p.pixel_format)); |
| + m->WriteInt(static_cast<int>(p.pixel_storage)); |
| } |
| bool ParamTraits<VideoCaptureFormat>::Read(const Message* m, |
| base::PickleIterator* iter, |
| VideoCaptureFormat* r) { |
| - int frame_size_width, frame_size_height, pixel_format; |
| - if (!iter->ReadInt(&frame_size_width) || |
| - !iter->ReadInt(&frame_size_height) || |
| - !iter->ReadFloat(&r->frame_rate) || |
| - !iter->ReadInt(&pixel_format)) |
| - return false; |
| - |
| - r->frame_size.SetSize(frame_size_width, frame_size_height); |
| - r->pixel_format = static_cast<VideoPixelFormat>(pixel_format); |
| - if (!r->IsValid()) |
| + if (!ReadParam(m, iter, &r->frame_size) || |
| + !ReadParam(m, iter, &r->frame_rate) || |
| + !ReadParam(m, iter, &r->pixel_format) || |
| + !ReadParam(m, iter, &r->pixel_storage)) { |
| return false; |
| - return true; |
| + } |
| + return r->IsValid(); |
| } |
| void ParamTraits<VideoCaptureFormat>::Log(const VideoCaptureFormat& p, |