Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <inttypes.h> | 5 #include <inttypes.h> |
| 6 #include <stddef.h> | 6 #include <stddef.h> |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <algorithm> | 9 #include <algorithm> |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 1628 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1639 } | 1639 } |
| 1640 | 1640 |
| 1641 void VEAClient::FeedEncoderWithOutput(base::SharedMemory* shm) { | 1641 void VEAClient::FeedEncoderWithOutput(base::SharedMemory* shm) { |
| 1642 DCHECK(thread_checker_.CalledOnValidThread()); | 1642 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1643 if (!has_encoder()) | 1643 if (!has_encoder()) |
| 1644 return; | 1644 return; |
| 1645 | 1645 |
| 1646 if (state_ != CS_ENCODING) | 1646 if (state_ != CS_ENCODING) |
| 1647 return; | 1647 return; |
| 1648 | 1648 |
| 1649 base::SharedMemoryHandle dup_handle; | 1649 base::SharedMemoryHandle dup_handle = shm->handle().Duplicate(); |
| 1650 LOG_ASSERT(shm->ShareToProcess(base::GetCurrentProcessHandle(), &dup_handle)); | 1650 LOG_ASSERT(dup_handle.IsValid()); |
| 1651 | 1651 |
| 1652 BitstreamBuffer bitstream_buffer(next_output_buffer_id_++, dup_handle, | 1652 BitstreamBuffer bitstream_buffer(next_output_buffer_id_++, dup_handle, |
|
Nico
2017/05/02 20:08:01
likewise
erikchen
2017/05/02 21:33:10
Done.
| |
| 1653 output_buffer_size_); | 1653 output_buffer_size_); |
| 1654 LOG_ASSERT(output_buffers_at_client_ | 1654 LOG_ASSERT(output_buffers_at_client_ |
| 1655 .insert(std::make_pair(bitstream_buffer.id(), shm)) | 1655 .insert(std::make_pair(bitstream_buffer.id(), shm)) |
| 1656 .second); | 1656 .second); |
| 1657 | 1657 |
| 1658 encode_task_runner_->PostTask( | 1658 encode_task_runner_->PostTask( |
| 1659 FROM_HERE, | 1659 FROM_HERE, |
| 1660 base::Bind(&VideoEncodeAccelerator::UseOutputBitstreamBuffer, | 1660 base::Bind(&VideoEncodeAccelerator::UseOutputBitstreamBuffer, |
| 1661 encoder_weak_factory_->GetWeakPtr(), bitstream_buffer)); | 1661 encoder_weak_factory_->GetWeakPtr(), bitstream_buffer)); |
| 1662 } | 1662 } |
| (...skipping 242 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1905 output_shms_.push_back(shm); | 1905 output_shms_.push_back(shm); |
| 1906 FeedEncoderWithOutput(shm, output_size); | 1906 FeedEncoderWithOutput(shm, output_size); |
| 1907 } | 1907 } |
| 1908 } | 1908 } |
| 1909 | 1909 |
| 1910 void SimpleVEAClientBase::FeedEncoderWithOutput(base::SharedMemory* shm, | 1910 void SimpleVEAClientBase::FeedEncoderWithOutput(base::SharedMemory* shm, |
| 1911 size_t output_size) { | 1911 size_t output_size) { |
| 1912 if (!has_encoder()) | 1912 if (!has_encoder()) |
| 1913 return; | 1913 return; |
| 1914 | 1914 |
| 1915 base::SharedMemoryHandle dup_handle; | 1915 base::SharedMemoryHandle dup_handle = shm->handle().Duplicate(); |
| 1916 LOG_ASSERT(shm->ShareToProcess(base::GetCurrentProcessHandle(), &dup_handle)); | 1916 LOG_ASSERT(dup_handle.IsValid()); |
| 1917 | 1917 |
| 1918 BitstreamBuffer bitstream_buffer(next_output_buffer_id_++, dup_handle, | 1918 BitstreamBuffer bitstream_buffer(next_output_buffer_id_++, dup_handle, |
| 1919 output_size); | 1919 output_size); |
| 1920 encoder_->UseOutputBitstreamBuffer(bitstream_buffer); | 1920 encoder_->UseOutputBitstreamBuffer(bitstream_buffer); |
| 1921 } | 1921 } |
| 1922 | 1922 |
| 1923 // This client is only used to make sure the encoder does not return an encoded | 1923 // This client is only used to make sure the encoder does not return an encoded |
| 1924 // frame before getting any input. | 1924 // frame before getting any input. |
| 1925 class VEANoInputClient : public SimpleVEAClientBase { | 1925 class VEANoInputClient : public SimpleVEAClientBase { |
| 1926 public: | 1926 public: |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2378 | 2378 |
| 2379 media::g_env = | 2379 media::g_env = |
| 2380 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( | 2380 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( |
| 2381 testing::AddGlobalTestEnvironment( | 2381 testing::AddGlobalTestEnvironment( |
| 2382 new media::VideoEncodeAcceleratorTestEnvironment( | 2382 new media::VideoEncodeAcceleratorTestEnvironment( |
| 2383 std::move(test_stream_data), log_path, run_at_fps, | 2383 std::move(test_stream_data), log_path, run_at_fps, |
| 2384 needs_encode_latency, verify_all_output))); | 2384 needs_encode_latency, verify_all_output))); |
| 2385 | 2385 |
| 2386 return RUN_ALL_TESTS(); | 2386 return RUN_ALL_TESTS(); |
| 2387 } | 2387 } |
| OLD | NEW |