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

Unified Diff: media/base/video_frame_impl.cc

Issue 165472: Merge 23255 - Implemented endofstream callback for media::PipelineImpl.... (Closed) Base URL: svn://chrome-svn/chrome/branches/195/src/
Patch Set: Created 11 years, 4 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
« no previous file with comments | « media/base/video_frame_impl.h ('k') | media/base/video_frame_impl_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame_impl.cc
===================================================================
--- media/base/video_frame_impl.cc (revision 23335)
+++ media/base/video_frame_impl.cc (working copy)
@@ -52,6 +52,48 @@
*frame_out = new VideoFrameImpl(VideoSurface::EMPTY, 0, 0);
}
+// static
+void VideoFrameImpl::CreateBlackFrame(int width, int height,
+ scoped_refptr<VideoFrame>* frame_out) {
+ DCHECK_GT(width, 0);
+ DCHECK_GT(height, 0);
+
+ // Create our frame.
+ scoped_refptr<VideoFrame> frame;
+ const base::TimeDelta kZero;
+ VideoFrameImpl::CreateFrame(VideoSurface::YV12, width, height, kZero, kZero,
+ &frame);
+ DCHECK(frame);
+
+ // Now set the data to YUV(0,128,128).
+ const uint8 kBlackY = 0x00;
+ const uint8 kBlackUV = 0x80;
+ VideoSurface surface;
+ frame->Lock(&surface);
+ DCHECK_EQ(VideoSurface::YV12, surface.format) << "Expected YV12 surface";
+
+ // Fill the Y plane.
+ for (size_t i = 0; i < surface.height; ++i) {
+ memset(surface.data[VideoSurface::kYPlane], kBlackY, surface.width);
+ surface.data[VideoSurface::kYPlane]
+ += surface.strides[VideoSurface::kYPlane];
+ }
+
+ // Fill the U and V planes.
+ for (size_t i = 0; i < (surface.height / 2); ++i) {
+ memset(surface.data[VideoSurface::kUPlane], kBlackUV, surface.width / 2);
+ memset(surface.data[VideoSurface::kVPlane], kBlackUV, surface.width / 2);
+ surface.data[VideoSurface::kUPlane] +=
+ surface.strides[VideoSurface::kUPlane];
+ surface.data[VideoSurface::kVPlane] +=
+ surface.strides[VideoSurface::kVPlane];
+ }
+ frame->Unlock();
+
+ // Success!
+ *frame_out = frame;
+}
+
static inline size_t RoundUp(size_t value, size_t alignment) {
// Check that |alignment| is a power of 2.
DCHECK((alignment + (alignment - 1)) == (alignment | (alignment - 1)));
Property changes on: media\base\video_frame_impl.cc
___________________________________________________________________
Added: svn:mergeinfo
Merged /branches/chrome_webkit_merge_branch/media/base/video_frame_impl.cc:r69-2775
Merged /trunk/src/media/base/video_frame_impl.cc:r23255
« no previous file with comments | « media/base/video_frame_impl.h ('k') | media/base/video_frame_impl_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698