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

Unified Diff: content/common/media/media_param_traits.cc

Issue 1204063005: Reland: Video Capture: extract storage info from pixel format in VideoCaptureFormat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: dcheng@ nit on DCHECK_EQ(expected, actual) Created 5 years, 6 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 side-by-side diff with in-line comments
Download patch
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()));
}
}
« no previous file with comments | « content/browser/renderer_host/render_message_filter.cc ('k') | content/common/media/video_capture_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698