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

Side by Side 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: 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 // The bulk of this file is support code; sorry about that. Here's an overview 5 // The bulk of this file is support code; sorry about that. Here's an overview
6 // to hopefully help readers of this code: 6 // to hopefully help readers of this code:
7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or 7 // - RenderingHelper is charged with interacting with X11/{EGL/GLES2,GLX/GL} or
8 // Win/EGL. 8 // Win/EGL.
9 // - ClientState is an enum for the state of the decode client used by the test. 9 // - ClientState is an enum for the state of the decode client used by the test.
10 // - ClientStateNotification is a barrier abstraction that allows the test code 10 // - ClientStateNotification is a barrier abstraction that allows the test code
(...skipping 585 matching lines...) Expand 10 before | Expand all | Expand 10 after
596 size_t next_fragment_size = next_fragment_bytes.size(); 596 size_t next_fragment_size = next_fragment_bytes.size();
597 597
598 // Populate the shared memory buffer w/ the fragments, duplicate its handle, 598 // Populate the shared memory buffer w/ the fragments, duplicate its handle,
599 // and hand it off to the decoder. 599 // and hand it off to the decoder.
600 base::SharedMemory shm; 600 base::SharedMemory shm;
601 CHECK(shm.CreateAndMapAnonymous(next_fragment_size)); 601 CHECK(shm.CreateAndMapAnonymous(next_fragment_size));
602 memcpy(shm.memory(), next_fragment_bytes.data(), next_fragment_size); 602 memcpy(shm.memory(), next_fragment_bytes.data(), next_fragment_size);
603 base::SharedMemoryHandle dup_handle; 603 base::SharedMemoryHandle dup_handle;
604 CHECK(shm.ShareToProcess(base::Process::Current().handle(), &dup_handle)); 604 CHECK(shm.ShareToProcess(base::Process::Current().handle(), &dup_handle));
605 media::BitstreamBuffer bitstream_buffer( 605 media::BitstreamBuffer bitstream_buffer(
606 next_bitstream_buffer_id_++, dup_handle, next_fragment_size); 606 next_bitstream_buffer_id_, dup_handle, next_fragment_size);
607 next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x7FFFFFFF;
Ami GONE FROM CHROMIUM 2013/01/10 23:13:56 This is kind of silly (since this is a unittest wi
sheu 2013/01/10 23:34:48 Fine. :-)
607 decoder_->Decode(bitstream_buffer); 608 decoder_->Decode(bitstream_buffer);
608 ++outstanding_decodes_; 609 ++outstanding_decodes_;
609 encoded_data_next_pos_to_decode_ = end_pos; 610 encoded_data_next_pos_to_decode_ = end_pos;
610 611
611 if (!remaining_play_throughs_ && 612 if (!remaining_play_throughs_ &&
612 -delete_decoder_state_ == next_bitstream_buffer_id_) { 613 -delete_decoder_state_ == next_bitstream_buffer_id_) {
613 DeleteDecoder(); 614 DeleteDecoder();
614 } 615 }
615 } 616 }
616 617
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after
935 base::Unretained(&event))); 936 base::Unretained(&event)));
936 event.Wait(); 937 event.Wait();
937 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL) 938 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_ARMEL)
938 content::OmxVideoDecodeAccelerator::PreSandboxInitialization(); 939 content::OmxVideoDecodeAccelerator::PreSandboxInitialization();
939 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY) 940 #elif defined(OS_CHROMEOS) && defined(ARCH_CPU_X86_FAMILY)
940 content::VaapiVideoDecodeAccelerator::PreSandboxInitialization(); 941 content::VaapiVideoDecodeAccelerator::PreSandboxInitialization();
941 #endif 942 #endif
942 943
943 return RUN_ALL_TESTS(); 944 return RUN_ALL_TESTS();
944 } 945 }
OLDNEW
« no previous file with comments | « content/common/gpu/media/gpu_video_decode_accelerator.cc ('k') | media/filters/gpu_video_decoder.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698