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

Unified Diff: media/base/video_frame.cc

Issue 2933573003: media: Followup changes to VideoFrame StructTraits. (Closed)
Patch Set: const& 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
« no previous file with comments | « no previous file | media/mojo/common/media_type_converters.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: media/base/video_frame.cc
diff --git a/media/base/video_frame.cc b/media/base/video_frame.cc
index 7ac322a0f8499c841152ec42514ebdf0886801c1..8e3eaff9f7aac5f9b5ed61be1f6a2cee2465fd07 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, const gfx::Rect& b) {
+ 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') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698