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 244 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
255 int num_play_throughs, | 255 int num_play_throughs, |
256 int reset_after_frame_num, | 256 int reset_after_frame_num, |
257 int delete_decoder_state, | 257 int delete_decoder_state, |
258 int frame_width, | 258 int frame_width, |
259 int frame_height, | 259 int frame_height, |
260 media::VideoCodecProfile profile, | 260 media::VideoCodecProfile profile, |
261 bool suppress_rendering, | 261 bool suppress_rendering, |
262 int delay_reuse_after_frame_num, | 262 int delay_reuse_after_frame_num, |
263 int decode_calls_per_second, | 263 int decode_calls_per_second, |
264 bool render_as_thumbnails); | 264 bool render_as_thumbnails); |
265 virtual ~GLRenderingVDAClient(); | 265 ~GLRenderingVDAClient() override; |
266 void CreateAndStartDecoder(); | 266 void CreateAndStartDecoder(); |
267 | 267 |
268 // VideoDecodeAccelerator::Client implementation. | 268 // VideoDecodeAccelerator::Client implementation. |
269 // The heart of the Client. | 269 // The heart of the Client. |
270 virtual void ProvidePictureBuffers(uint32 requested_num_of_buffers, | 270 void ProvidePictureBuffers(uint32 requested_num_of_buffers, |
271 const gfx::Size& dimensions, | 271 const gfx::Size& dimensions, |
272 uint32 texture_target) override; | 272 uint32 texture_target) override; |
273 virtual void DismissPictureBuffer(int32 picture_buffer_id) override; | 273 void DismissPictureBuffer(int32 picture_buffer_id) override; |
274 virtual void PictureReady(const media::Picture& picture) override; | 274 void PictureReady(const media::Picture& picture) override; |
275 // Simple state changes. | 275 // Simple state changes. |
276 virtual void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) override; | 276 void NotifyEndOfBitstreamBuffer(int32 bitstream_buffer_id) override; |
277 virtual void NotifyFlushDone() override; | 277 void NotifyFlushDone() override; |
278 virtual void NotifyResetDone() override; | 278 void NotifyResetDone() override; |
279 virtual void NotifyError(VideoDecodeAccelerator::Error error) override; | 279 void NotifyError(VideoDecodeAccelerator::Error error) override; |
280 | 280 |
281 void OutputFrameDeliveryTimes(base::File* output); | 281 void OutputFrameDeliveryTimes(base::File* output); |
282 | 282 |
283 // Simple getters for inspecting the state of the Client. | 283 // Simple getters for inspecting the state of the Client. |
284 int num_done_bitstream_buffers() { return num_done_bitstream_buffers_; } | 284 int num_done_bitstream_buffers() { return num_done_bitstream_buffers_; } |
285 int num_skipped_fragments() { return num_skipped_fragments_; } | 285 int num_skipped_fragments() { return num_skipped_fragments_; } |
286 int num_queued_fragments() { return num_queued_fragments_; } | 286 int num_queued_fragments() { return num_queued_fragments_; } |
287 int num_decoded_frames() { return num_decoded_frames_; } | 287 int num_decoded_frames() { return num_decoded_frames_; } |
288 double frames_per_second(); | 288 double frames_per_second(); |
289 // Return the median of the decode time of all decoded frames. | 289 // Return the median of the decode time of all decoded frames. |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
907 int index = decode_time_.size() / 2; | 907 int index = decode_time_.size() / 2; |
908 if (decode_time_.size() % 2 != 0) | 908 if (decode_time_.size() % 2 != 0) |
909 return decode_time_[index]; | 909 return decode_time_[index]; |
910 | 910 |
911 return (decode_time_[index] + decode_time_[index - 1]) / 2; | 911 return (decode_time_[index] + decode_time_[index - 1]) / 2; |
912 } | 912 } |
913 | 913 |
914 class VideoDecodeAcceleratorTest : public ::testing::Test { | 914 class VideoDecodeAcceleratorTest : public ::testing::Test { |
915 protected: | 915 protected: |
916 VideoDecodeAcceleratorTest(); | 916 VideoDecodeAcceleratorTest(); |
917 virtual void SetUp(); | 917 void SetUp() override; |
918 virtual void TearDown(); | 918 void TearDown() override; |
919 | 919 |
920 // Parse |data| into its constituent parts, set the various output fields | 920 // Parse |data| into its constituent parts, set the various output fields |
921 // accordingly, and read in video stream. CHECK-fails on unexpected or | 921 // accordingly, and read in video stream. CHECK-fails on unexpected or |
922 // missing required data. Unspecified optional fields are set to -1. | 922 // missing required data. Unspecified optional fields are set to -1. |
923 void ParseAndReadTestVideoData(base::FilePath::StringType data, | 923 void ParseAndReadTestVideoData(base::FilePath::StringType data, |
924 std::vector<TestVideoFile*>* test_video_files); | 924 std::vector<TestVideoFile*>* test_video_files); |
925 | 925 |
926 // Update the parameters of |test_video_files| according to | 926 // Update the parameters of |test_video_files| according to |
927 // |num_concurrent_decoders| and |reset_point|. Ex: the expected number of | 927 // |num_concurrent_decoders| and |reset_point|. Ex: the expected number of |
928 // frames should be adjusted if decoder is reset in the middle of the stream. | 928 // frames should be adjusted if decoder is reset in the middle of the stream. |
(...skipping 617 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1546 continue; | 1546 continue; |
1547 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1547 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
1548 } | 1548 } |
1549 | 1549 |
1550 base::ShadowingAtExitManager at_exit_manager; | 1550 base::ShadowingAtExitManager at_exit_manager; |
1551 base::MessageLoop main_loop; | 1551 base::MessageLoop main_loop; |
1552 content::RenderingHelper::InitializeOneOff(); | 1552 content::RenderingHelper::InitializeOneOff(); |
1553 | 1553 |
1554 return RUN_ALL_TESTS(); | 1554 return RUN_ALL_TESTS(); |
1555 } | 1555 } |
OLD | NEW |