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

Unified Diff: content/common/gpu/media_messages.cc

Issue 1541353002: Add offset support to BitstreamBuffer. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: address dcheng's comments Created 4 years, 10 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 | « content/common/gpu/media/vaapi_video_encode_accelerator.cc ('k') | content/content_common.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media_messages.cc
diff --git a/content/common/gpu/media_messages.cc b/content/common/gpu/media_messages.cc
index 74bd702850ad978d692deaa4ee6a5d2f256dc566..9db4ae17fb5e01ed62f40d0fe457249d595d544c 100644
--- a/content/common/gpu/media_messages.cc
+++ b/content/common/gpu/media_messages.cc
@@ -16,6 +16,8 @@ void ParamTraits<media::BitstreamBuffer>::Write(base::Pickle* m,
const param_type& p) {
WriteParam(m, p.id());
WriteParam(m, static_cast<uint64_t>(p.size()));
+ DCHECK_GE(p.offset(), 0);
+ WriteParam(m, static_cast<int64_t>(p.offset()));
dcheng 2016/03/05 01:30:57 static_cast<uint64_t> (and corresponding change on
WriteParam(m, p.presentation_timestamp());
WriteParam(m, p.key_id());
if (!p.key_id().empty()) {
@@ -30,7 +32,9 @@ bool ParamTraits<media::BitstreamBuffer>::Read(const base::Pickle* m,
param_type* r) {
DCHECK(r);
uint64_t size = 0;
+ int64_t offset = 0;
if (!(ReadParam(m, iter, &r->id_) && ReadParam(m, iter, &size) &&
+ ReadParam(m, iter, &offset) &&
ReadParam(m, iter, &r->presentation_timestamp_) &&
ReadParam(m, iter, &r->key_id_)))
return false;
@@ -42,6 +46,13 @@ bool ParamTraits<media::BitstreamBuffer>::Read(const base::Pickle* m,
}
r->size_ = checked_size.ValueOrDie();
+ base::CheckedNumeric<off_t> checked_offset(offset);
+ if (!checked_offset.IsValid() || offset < 0) {
+ DLOG(ERROR) << "Invalid offset: " << offset;
+ return false;
+ }
+ r->offset_ = checked_offset.ValueOrDie();
+
if (!r->key_id_.empty()) {
if (!(ReadParam(m, iter, &r->iv_) && ReadParam(m, iter, &r->subsamples_)))
return false;
« no previous file with comments | « content/common/gpu/media/vaapi_video_encode_accelerator.cc ('k') | content/content_common.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698