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

Unified Diff: media/base/video_frame.cc

Issue 2933573003: media: Followup changes to VideoFrame StructTraits. (Closed)
Patch Set: ToString() Created 3 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: media/base/video_frame.cc
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 7ac322a0f8499c841152ec42514ebdf0886801c1..15a88fdef104f13a10719de6a50c8798b0a8e953 100644
--- a/media/base/video_frame.cc
+++ b/media/base/video_frame.cc
@@ -23,6 +23,16 @@
namespace media {
+namespace {
+
+// Helper to privide gfx::Rect::Intersect() as an expression.
+gfx::Rect Intersection(gfx::Rect a, gfx::Rect b) {
dcheng 2017/06/13 07:10:16 |b| can be passed by const ref, right?
sandersd (OOO until July 31) 2017/06/13 17:50:15 Done.
+ a.Intersect(b);
+ return a;
+}
+
+} // namespace
+
// Static POD class for generating unique identifiers for each VideoFrame.
static base::StaticAtomicSequenceNumber g_unique_id_generator;
@@ -923,13 +933,16 @@ VideoFrame::VideoFrame(VideoPixelFormat format,
: format_(format),
storage_type_(storage_type),
coded_size_(coded_size),
- visible_rect_(visible_rect),
+ visible_rect_(Intersection(visible_rect, gfx::Rect(coded_size))),
natural_size_(natural_size),
shared_memory_offset_(0),
timestamp_(timestamp),
unique_id_(g_unique_id_generator.GetNext()) {
DCHECK(IsValidConfig(format_, storage_type, coded_size_, visible_rect_,
natural_size_));
+ DCHECK(visible_rect_ == visible_rect)
+ << "visible_rect " << visible_rect.ToString() << " exceeds coded_size "
+ << coded_size.ToString();
memset(&mailbox_holders_, 0, sizeof(mailbox_holders_));
memset(&strides_, 0, sizeof(strides_));
memset(&data_, 0, sizeof(data_));
« no previous file with comments | « no previous file | media/mojo/common/media_type_converters.h » ('j') | media/mojo/interfaces/video_frame_struct_traits.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698