Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 1067 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1078 next_fragment_size, profile_); | 1078 next_fragment_size, profile_); |
| 1079 if (reset_here) | 1079 if (reset_here) |
| 1080 reset_after_frame_num_ = END_OF_STREAM_RESET; | 1080 reset_after_frame_num_ = END_OF_STREAM_RESET; |
| 1081 } | 1081 } |
| 1082 | 1082 |
| 1083 // Populate the shared memory buffer w/ the fragment, duplicate its handle, | 1083 // Populate the shared memory buffer w/ the fragment, duplicate its handle, |
| 1084 // and hand it off to the decoder. | 1084 // and hand it off to the decoder. |
| 1085 base::SharedMemory shm; | 1085 base::SharedMemory shm; |
| 1086 LOG_ASSERT(shm.CreateAndMapAnonymous(next_fragment_size)); | 1086 LOG_ASSERT(shm.CreateAndMapAnonymous(next_fragment_size)); |
| 1087 memcpy(shm.memory(), next_fragment_bytes.data(), next_fragment_size); | 1087 memcpy(shm.memory(), next_fragment_bytes.data(), next_fragment_size); |
| 1088 base::SharedMemoryHandle dup_handle; | 1088 base::SharedMemoryHandle dup_handle = shm.handle().Duplicate(); |
| 1089 bool result = | 1089 LOG_ASSERT(dup_handle.IsValid()); |
| 1090 shm.ShareToProcess(base::GetCurrentProcessHandle(), &dup_handle); | |
| 1091 LOG_ASSERT(result); | |
| 1092 BitstreamBuffer bitstream_buffer(next_bitstream_buffer_id_, dup_handle, | 1090 BitstreamBuffer bitstream_buffer(next_bitstream_buffer_id_, dup_handle, |
|
Nico
2017/05/02 20:08:01
I tried to verify that BitstreamBuffer assumes own
erikchen
2017/05/02 21:33:10
Added a TODO
| |
| 1093 next_fragment_size); | 1091 next_fragment_size); |
| 1094 decode_start_time_[next_bitstream_buffer_id_] = base::TimeTicks::Now(); | 1092 decode_start_time_[next_bitstream_buffer_id_] = base::TimeTicks::Now(); |
| 1095 // Mask against 30 bits, to avoid (undefined) wraparound on signed integer. | 1093 // Mask against 30 bits, to avoid (undefined) wraparound on signed integer. |
| 1096 next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x3FFFFFFF; | 1094 next_bitstream_buffer_id_ = (next_bitstream_buffer_id_ + 1) & 0x3FFFFFFF; |
| 1097 decoder_->Decode(bitstream_buffer); | 1095 decoder_->Decode(bitstream_buffer); |
| 1098 ++outstanding_decodes_; | 1096 ++outstanding_decodes_; |
| 1099 if (!remaining_play_throughs_ && | 1097 if (!remaining_play_throughs_ && |
| 1100 -delete_decoder_state_ == next_bitstream_buffer_id_) { | 1098 -delete_decoder_state_ == next_bitstream_buffer_id_) { |
| 1101 DeleteDecoder(); | 1099 DeleteDecoder(); |
| 1102 } | 1100 } |
| (...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1915 media::g_thumbnail_output_dir = base::FilePath(it->second.c_str()); | 1913 media::g_thumbnail_output_dir = base::FilePath(it->second.c_str()); |
| 1916 } | 1914 } |
| 1917 } | 1915 } |
| 1918 | 1916 |
| 1919 base::ShadowingAtExitManager at_exit_manager; | 1917 base::ShadowingAtExitManager at_exit_manager; |
| 1920 | 1918 |
| 1921 return base::LaunchUnitTestsSerially( | 1919 return base::LaunchUnitTestsSerially( |
| 1922 argc, argv, | 1920 argc, argv, |
| 1923 base::Bind(&media::VDATestSuite::Run, base::Unretained(&test_suite))); | 1921 base::Bind(&media::VDATestSuite::Run, base::Unretained(&test_suite))); |
| 1924 } | 1922 } |
| OLD | NEW |