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

Side by Side Diff: media/filters/gpu_video_decoder.cc

Issue 11826064: Enforce non-negative BitstreamBuffer id (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Avoid wrapping signed integers. 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 unified diff | Download patch
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/filters/gpu_video_decoder.h" 5 #include "media/filters/gpu_video_decoder.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/callback_helpers.h" 8 #include "base/callback_helpers.h"
9 #include "base/cpu.h" 9 #include "base/cpu.h"
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
277 return; 277 return;
278 } 278 }
279 279
280 if (!pending_reset_cb_.is_null()) 280 if (!pending_reset_cb_.is_null())
281 return; 281 return;
282 282
283 size_t size = buffer->GetDataSize(); 283 size_t size = buffer->GetDataSize();
284 SHMBuffer* shm_buffer = GetSHM(size); 284 SHMBuffer* shm_buffer = GetSHM(size);
285 memcpy(shm_buffer->shm->memory(), buffer->GetData(), size); 285 memcpy(shm_buffer->shm->memory(), buffer->GetData(), size);
286 BitstreamBuffer bitstream_buffer( 286 BitstreamBuffer bitstream_buffer(
287 next_bitstream_buffer_id_++, shm_buffer->shm->handle(), size); 287 next_bitstream_buffer_id_, shm_buffer->shm->handle(), size);
288 next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x3FFFFFFF;
Ami GONE FROM CHROMIUM 2013/01/10 23:41:31 Weird enough to deserve a comment. Note that here
288 bool inserted = bitstream_buffers_in_decoder_.insert(std::make_pair( 289 bool inserted = bitstream_buffers_in_decoder_.insert(std::make_pair(
289 bitstream_buffer.id(), BufferPair(shm_buffer, buffer))).second; 290 bitstream_buffer.id(), BufferPair(shm_buffer, buffer))).second;
290 DCHECK(inserted); 291 DCHECK(inserted);
291 RecordBufferData(bitstream_buffer, *buffer); 292 RecordBufferData(bitstream_buffer, *buffer);
292 293
293 vda_loop_proxy_->PostTask(FROM_HERE, base::Bind( 294 vda_loop_proxy_->PostTask(FROM_HERE, base::Bind(
294 &VideoDecodeAccelerator::Decode, weak_vda_, bitstream_buffer)); 295 &VideoDecodeAccelerator::Decode, weak_vda_, bitstream_buffer));
295 296
296 if (CanMoreDecodeWorkBeDone()) 297 if (CanMoreDecodeWorkBeDone())
297 EnsureDemuxOrDecode(); 298 EnsureDemuxOrDecode();
(...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after
581 582
582 error_occured_ = true; 583 error_occured_ = true;
583 584
584 if (!pending_read_cb_.is_null()) { 585 if (!pending_read_cb_.is_null()) {
585 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL); 586 base::ResetAndReturn(&pending_read_cb_).Run(kDecodeError, NULL);
586 return; 587 return;
587 } 588 }
588 } 589 }
589 590
590 } // namespace media 591 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698