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

Unified Diff: content/common/gpu/media/video_decode_accelerator_unittest.cc

Issue 11826064: Enforce non-negative BitstreamBuffer id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Documented the wrapping at 30 bits. Created 7 years, 11 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/gpu_video_decode_accelerator.cc ('k') | media/filters/gpu_video_decoder.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/common/gpu/media/video_decode_accelerator_unittest.cc
diff --git a/content/common/gpu/media/video_decode_accelerator_unittest.cc b/content/common/gpu/media/video_decode_accelerator_unittest.cc
index f325b40c8fcd317f72648a9fc05fdf9285775246..99e6a4459b5113edb4a08537cbc93be340beaa92 100644
--- a/content/common/gpu/media/video_decode_accelerator_unittest.cc
+++ b/content/common/gpu/media/video_decode_accelerator_unittest.cc
@@ -603,7 +603,9 @@ void GLRenderingVDAClient::DecodeNextFragments() {
base::SharedMemoryHandle dup_handle;
CHECK(shm.ShareToProcess(base::Process::Current().handle(), &dup_handle));
media::BitstreamBuffer bitstream_buffer(
- next_bitstream_buffer_id_++, dup_handle, next_fragment_size);
+ next_bitstream_buffer_id_, dup_handle, next_fragment_size);
+ // Mask against 30 bits, to avoid (undefined) wraparound on signed integer.
+ next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x3FFFFFFF;
decoder_->Decode(bitstream_buffer);
++outstanding_decodes_;
encoded_data_next_pos_to_decode_ = end_pos;
« no previous file with comments | « content/common/gpu/media/gpu_video_decode_accelerator.cc ('k') | media/filters/gpu_video_decoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698