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

Side by Side Diff: media/base/video_frame.cc

Issue 187573006: Allow wrapping a media::VideoFrame with a new view_rect. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Only allow sub rect of original view_rect. Created 6 years, 9 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « media/base/video_frame.h ('k') | media/base/video_frame_pool.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "media/base/video_frame.h" 5 #include "media/base/video_frame.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 8
9 #include "base/bind.h" 9 #include "base/bind.h"
10 #include "base/callback_helpers.h" 10 #include "base/callback_helpers.h"
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 frame->data_[kYPlane] = y_data; 173 frame->data_[kYPlane] = y_data;
174 frame->data_[kUPlane] = u_data; 174 frame->data_[kUPlane] = u_data;
175 frame->data_[kVPlane] = v_data; 175 frame->data_[kVPlane] = v_data;
176 frame->no_longer_needed_cb_ = no_longer_needed_cb; 176 frame->no_longer_needed_cb_ = no_longer_needed_cb;
177 return frame; 177 return frame;
178 } 178 }
179 179
180 // static 180 // static
181 scoped_refptr<VideoFrame> VideoFrame::WrapVideoFrame( 181 scoped_refptr<VideoFrame> VideoFrame::WrapVideoFrame(
182 const scoped_refptr<VideoFrame>& frame, 182 const scoped_refptr<VideoFrame>& frame,
183 const gfx::Rect& visible_rect,
183 const base::Closure& no_longer_needed_cb) { 184 const base::Closure& no_longer_needed_cb) {
185 DCHECK(visible_rect.x() >= frame->visible_rect().x() &&
186 visible_rect.y() >= frame->visible_rect().y() &&
187 visible_rect.right() <= frame->visible_rect().right() &&
188 visible_rect.bottom() <= frame->visible_rect().bottom());
Ami GONE FROM CHROMIUM 2014/03/05 20:05:13 aka DCHECK(frame->visible_rect().Contains(visible_
perkj_chrome 2014/03/06 07:40:14 thanks.
184 scoped_refptr<VideoFrame> wrapped_frame(new VideoFrame( 189 scoped_refptr<VideoFrame> wrapped_frame(new VideoFrame(
185 frame->format(), frame->coded_size(), frame->visible_rect(), 190 frame->format(), frame->coded_size(), visible_rect,
186 frame->natural_size(), frame->GetTimestamp(), frame->end_of_stream())); 191 frame->natural_size(), frame->GetTimestamp(), frame->end_of_stream()));
187 192
188 for (size_t i = 0; i < NumPlanes(frame->format()); ++i) { 193 for (size_t i = 0; i < NumPlanes(frame->format()); ++i) {
189 wrapped_frame->strides_[i] = frame->stride(i); 194 wrapped_frame->strides_[i] = frame->stride(i);
190 wrapped_frame->data_[i] = frame->data(i); 195 wrapped_frame->data_[i] = frame->data(i);
191 } 196 }
192 197
193 wrapped_frame->no_longer_needed_cb_ = no_longer_needed_cb; 198 wrapped_frame->no_longer_needed_cb_ = no_longer_needed_cb;
194 return wrapped_frame; 199 return wrapped_frame;
195 } 200 }
(...skipping 304 matching lines...) Expand 10 before | Expand all | Expand 10 after
500 break; 505 break;
501 for (int row = 0; row < rows(plane); ++row) { 506 for (int row = 0; row < rows(plane); ++row) {
502 base::MD5Update(context, base::StringPiece( 507 base::MD5Update(context, base::StringPiece(
503 reinterpret_cast<char*>(data(plane) + stride(plane) * row), 508 reinterpret_cast<char*>(data(plane) + stride(plane) * row),
504 row_bytes(plane))); 509 row_bytes(plane)));
505 } 510 }
506 } 511 }
507 } 512 }
508 513
509 } // namespace media 514 } // namespace media
OLDNEW
« no previous file with comments | « media/base/video_frame.h ('k') | media/base/video_frame_pool.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698