| 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..fc4d62efcba29d65c40b67f581e4a45ba66e78fa 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"
|
| +#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,
|
| @@ -58,33 +58,28 @@ void ParamTraits<AudioParameters>::Log(const AudioParameters& p,
|
|
|
| void ParamTraits<VideoCaptureFormat>::Write(Message* m,
|
| const VideoCaptureFormat& p) {
|
| - // Crash during Send rather than have a failure at the message handler.
|
| - m->WriteInt(p.frame_size.width());
|
| - m->WriteInt(p.frame_size.height());
|
| - m->WriteFloat(p.frame_rate);
|
| - m->WriteInt(static_cast<int>(p.pixel_format));
|
| + WriteParam(m, p.frame_size);
|
| + WriteParam(m, p.frame_rate);
|
| + WriteParam(m, p.pixel_format);
|
| + WriteParam(m, 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,
|
| std::string* l) {
|
| - l->append(base::StringPrintf("<VideoCaptureFormat>"));
|
| + l->append(
|
| + base::StringPrintf("<VideoCaptureFormat> %s", p.ToString().c_str()));
|
| }
|
|
|
| }
|
|
|