summaryrefslogtreecommitdiffstats
path: root/media
diff options
context:
space:
mode:
authormcasas <mcasas@chromium.org>2015-06-19 16:08:02 -0700
committerCommit bot <commit-bot@chromium.org>2015-06-19 23:08:25 +0000
commitfd568ac5147b59aced95013c57a86c27b83e1792 (patch)
tree5410193a2966f46a3997de3ddbbe4051a9838958 /media
parent2a0da66d06f3b9f40d28b25cc920f50ffc215591 (diff)
downloadchromium_src-fd568ac5147b59aced95013c57a86c27b83e1792.zip
chromium_src-fd568ac5147b59aced95013c57a86c27b83e1792.tar.gz
chromium_src-fd568ac5147b59aced95013c57a86c27b83e1792.tar.bz2
VideoCapture: merge IPC VideoCaptureMsg_BufferReady and VideoCaptureMsg_MailboxBufferRead.
Currently Browser->Render VideoFrame capture notifications has two messages, one for I420 ShMem frames and another for textures. This CL unifies both by sending the necessary data over IPC to reconstruct any at the Render side. This is also in anticipation of sending other pixel formats and/or combinations of format+storage types than the ones described in ToT. RESOLUTION_POLICY_LAST is updated so IPC validator can use it to test proper (de)serialisation of values. BUG=440843 TEST=This CL does _not_ introduce new functionality (does not pretend to), so all video capture should work as before. Review URL: https://codereview.chromium.org/1185443007 Cr-Commit-Position: refs/heads/master@{#335381}
Diffstat (limited to 'media')
-rw-r--r--media/base/video_capture_types.h3
-rw-r--r--media/base/video_frame.cc2
-rw-r--r--media/base/video_frame.h15
-rw-r--r--media/capture/capture_resolution_chooser.cc6
4 files changed, 18 insertions, 8 deletions
diff --git a/media/base/video_capture_types.h b/media/base/video_capture_types.h
index 8483a2d..520dafd 100644
--- a/media/base/video_capture_types.h
+++ b/media/base/video_capture_types.h
@@ -54,7 +54,8 @@ enum ResolutionChangePolicy {
// exceeding the maximum dimensions specified.
RESOLUTION_POLICY_ANY_WITHIN_LIMIT,
- RESOLUTION_POLICY_LAST,
+ // Must always be equal to largest entry in the enum.
+ RESOLUTION_POLICY_LAST = RESOLUTION_POLICY_ANY_WITHIN_LIMIT,
};
// Some drivers use rational time per frame instead of float frame rate, this
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 2aaf132..c5009fd 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -43,7 +43,7 @@ static bool IsValidPlane(size_t plane, VideoFrame::Format format) {
static bool IsStorageTypeMappable(VideoFrame::StorageType storage_type) {
return
#if defined(OS_LINUX)
- // This is not strictly needed but makes it explicit that, at VideoFrame
+ // This is not strictly needed but makes explicit that, at VideoFrame
// level, DmaBufs are not mappable from userspace.
storage_type != VideoFrame::STORAGE_DMABUFS &&
#endif
diff --git a/media/base/video_frame.h b/media/base/video_frame.h
index 9d97848..26dac09 100644
--- a/media/base/video_frame.h
+++ b/media/base/video_frame.h
@@ -84,10 +84,23 @@ class MEDIA_EXPORT VideoFrame : public base::RefCountedThreadSafe<VideoFrame> {
STORAGE_OWNED_MEMORY = 3, // VideoFrame has allocated its own data buffer.
STORAGE_SHMEM = 4, // Pixels are backed by Shared Memory.
#if defined(OS_LINUX)
+ // TODO(mcasas): Consider turning this type into STORAGE_NATIVE or another
+ // meaningful name and handle it appropriately in all cases.
STORAGE_DMABUFS = 5, // Each plane is stored into a DmaBuf.
#endif
#if defined(VIDEO_HOLE)
- STORAGE_HOLE = 6, // Opaque storage.
+ // Indicates protected media that needs to be directly rendered to hw. It
+ // is, in principle, platform independent, see http://crbug.com/323157 and
+ // https://groups.google.com/a/google.com/d/topic/chrome-gpu/eIM1RwarUmk/discussion
+ STORAGE_HOLE = 6,
+#endif
+
+#if defined(VIDEO_HOLE)
+ STORAGE_LAST = STORAGE_HOLE,
+#elif defined(OS_LINUX)
+ STORAGE_LAST = STORAGE_DMABUFS,
+#else
+ STORAGE_LAST = STORAGE_SHMEM
#endif
};
diff --git a/media/capture/capture_resolution_chooser.cc b/media/capture/capture_resolution_chooser.cc
index ff2ee9d..4f1ea53 100644
--- a/media/capture/capture_resolution_chooser.cc
+++ b/media/capture/capture_resolution_chooser.cc
@@ -34,8 +34,6 @@ gfx::Size ComputeMinimumCaptureSize(
}
case RESOLUTION_POLICY_ANY_WITHIN_LIMIT:
return gfx::Size(1, 1);
- case RESOLUTION_POLICY_LAST:
- break;
}
NOTREACHED();
return gfx::Size(1, 1);
@@ -75,6 +73,7 @@ CaptureResolutionChooser::CaptureResolutionChooser(
DCHECK_LT(0, max_frame_size_.height());
DCHECK_LE(min_frame_size_.width(), max_frame_size_.width());
DCHECK_LE(min_frame_size_.height(), max_frame_size_.height());
+ DCHECK_LE(resolution_change_policy_, RESOLUTION_POLICY_LAST);
RecomputeCaptureSize();
}
@@ -104,9 +103,6 @@ void CaptureResolutionChooser::SetSourceSize(const gfx::Size& source_size) {
source_size, min_frame_size_, max_frame_size_);
RecomputeCaptureSize();
break;
-
- case RESOLUTION_POLICY_LAST:
- NOTREACHED();
}
}