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 790 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
801 ~VEAClient() override; | 801 ~VEAClient() override; |
802 void CreateEncoder(); | 802 void CreateEncoder(); |
803 void DestroyEncoder(); | 803 void DestroyEncoder(); |
804 | 804 |
805 // VideoDecodeAccelerator::Client implementation. | 805 // VideoDecodeAccelerator::Client implementation. |
806 void RequireBitstreamBuffers(unsigned int input_count, | 806 void RequireBitstreamBuffers(unsigned int input_count, |
807 const gfx::Size& input_coded_size, | 807 const gfx::Size& input_coded_size, |
808 size_t output_buffer_size) override; | 808 size_t output_buffer_size) override; |
809 void BitstreamBufferReady(int32_t bitstream_buffer_id, | 809 void BitstreamBufferReady(int32_t bitstream_buffer_id, |
810 size_t payload_size, | 810 size_t payload_size, |
811 bool key_frame) override; | 811 bool key_frame, |
812 base::TimeDelta timestamp) override; | |
812 void NotifyError(VideoEncodeAccelerator::Error error) override; | 813 void NotifyError(VideoEncodeAccelerator::Error error) override; |
813 | 814 |
814 private: | 815 private: |
815 bool has_encoder() { return encoder_.get(); } | 816 bool has_encoder() { return encoder_.get(); } |
816 | 817 |
817 // Return the number of encoded frames per second. | 818 // Return the number of encoded frames per second. |
818 double frames_per_second(); | 819 double frames_per_second(); |
819 | 820 |
820 std::unique_ptr<media::VideoEncodeAccelerator> CreateFakeVEA(); | 821 std::unique_ptr<media::VideoEncodeAccelerator> CreateFakeVEA(); |
821 std::unique_ptr<media::VideoEncodeAccelerator> CreateV4L2VEA(); | 822 std::unique_ptr<media::VideoEncodeAccelerator> CreateV4L2VEA(); |
(...skipping 421 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1243 base::Bind(&VEAClient::OnInputTimer, base::Unretained(this))); | 1244 base::Bind(&VEAClient::OnInputTimer, base::Unretained(this))); |
1244 } else { | 1245 } else { |
1245 while (inputs_at_client_.size() < | 1246 while (inputs_at_client_.size() < |
1246 num_required_input_buffers_ + kNumExtraInputFrames) | 1247 num_required_input_buffers_ + kNumExtraInputFrames) |
1247 FeedEncoderWithOneInput(); | 1248 FeedEncoderWithOneInput(); |
1248 } | 1249 } |
1249 } | 1250 } |
1250 | 1251 |
1251 void VEAClient::BitstreamBufferReady(int32_t bitstream_buffer_id, | 1252 void VEAClient::BitstreamBufferReady(int32_t bitstream_buffer_id, |
1252 size_t payload_size, | 1253 size_t payload_size, |
1253 bool key_frame) { | 1254 bool key_frame, |
1255 base::TimeDelta timestamp) { | |
Pawel Osciak
2016/05/23 07:15:53
Please add a test case that tests input timestamps
shenghao
2016/05/24 10:50:19
Done.
| |
1254 DCHECK(thread_checker_.CalledOnValidThread()); | 1256 DCHECK(thread_checker_.CalledOnValidThread()); |
1255 ASSERT_LE(payload_size, output_buffer_size_); | 1257 ASSERT_LE(payload_size, output_buffer_size_); |
1256 | 1258 |
1257 IdToSHM::iterator it = output_buffers_at_client_.find(bitstream_buffer_id); | 1259 IdToSHM::iterator it = output_buffers_at_client_.find(bitstream_buffer_id); |
1258 ASSERT_NE(it, output_buffers_at_client_.end()); | 1260 ASSERT_NE(it, output_buffers_at_client_.end()); |
1259 base::SharedMemory* shm = it->second; | 1261 base::SharedMemory* shm = it->second; |
1260 output_buffers_at_client_.erase(it); | 1262 output_buffers_at_client_.erase(it); |
1261 | 1263 |
1262 if (state_ == CS_FINISHED || state_ == CS_VALIDATED) | 1264 if (state_ == CS_FINISHED || state_ == CS_VALIDATED) |
1263 return; | 1265 return; |
(...skipping 552 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1816 | 1818 |
1817 media::g_env = | 1819 media::g_env = |
1818 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( | 1820 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( |
1819 testing::AddGlobalTestEnvironment( | 1821 testing::AddGlobalTestEnvironment( |
1820 new media::VideoEncodeAcceleratorTestEnvironment( | 1822 new media::VideoEncodeAcceleratorTestEnvironment( |
1821 std::move(test_stream_data), log_path, run_at_fps, | 1823 std::move(test_stream_data), log_path, run_at_fps, |
1822 needs_encode_latency, verify_all_output))); | 1824 needs_encode_latency, verify_all_output))); |
1823 | 1825 |
1824 return RUN_ALL_TESTS(); | 1826 return RUN_ALL_TESTS(); |
1825 } | 1827 } |
OLD | NEW |