| 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> |
| 11 #include <queue> | 11 #include <queue> |
| 12 #include <string> | 12 #include <string> |
| 13 #include <utility> | 13 #include <utility> |
| 14 | 14 |
| 15 #include "base/at_exit.h" | 15 #include "base/at_exit.h" |
| 16 #include "base/bind.h" | 16 #include "base/bind.h" |
| 17 #include "base/bits.h" | 17 #include "base/bits.h" |
| 18 #include "base/command_line.h" | 18 #include "base/command_line.h" |
| 19 #include "base/files/file_util.h" | 19 #include "base/files/file_util.h" |
| 20 #include "base/macros.h" | 20 #include "base/macros.h" |
| 21 #include "base/memory/aligned_memory.h" | 21 #include "base/memory/aligned_memory.h" |
| 22 #include "base/memory/ptr_util.h" |
| 22 #include "base/memory/ref_counted.h" | 23 #include "base/memory/ref_counted.h" |
| 23 #include "base/memory/scoped_vector.h" | |
| 24 #include "base/memory/weak_ptr.h" | 24 #include "base/memory/weak_ptr.h" |
| 25 #include "base/message_loop/message_loop.h" | 25 #include "base/message_loop/message_loop.h" |
| 26 #include "base/numerics/safe_conversions.h" | 26 #include "base/numerics/safe_conversions.h" |
| 27 #include "base/process/process_handle.h" | 27 #include "base/process/process_handle.h" |
| 28 #include "base/single_thread_task_runner.h" | 28 #include "base/single_thread_task_runner.h" |
| 29 #include "base/strings/string_number_conversions.h" | 29 #include "base/strings/string_number_conversions.h" |
| 30 #include "base/strings/string_split.h" | 30 #include "base/strings/string_split.h" |
| 31 #include "base/strings/stringprintf.h" | 31 #include "base/strings/stringprintf.h" |
| 32 #include "base/strings/utf_string_conversions.h" | 32 #include "base/strings/utf_string_conversions.h" |
| 33 #include "base/threading/thread.h" | 33 #include "base/threading/thread.h" |
| (...skipping 339 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 373 } | 373 } |
| 374 src_offset += static_cast<off_t>(visible_buffer_size); | 374 src_offset += static_cast<off_t>(visible_buffer_size); |
| 375 } | 375 } |
| 376 src.Close(); | 376 src.Close(); |
| 377 | 377 |
| 378 LOG_ASSERT(test_stream->num_frames > 0UL); | 378 LOG_ASSERT(test_stream->num_frames > 0UL); |
| 379 } | 379 } |
| 380 | 380 |
| 381 // Parse |data| into its constituent parts, set the various output fields | 381 // Parse |data| into its constituent parts, set the various output fields |
| 382 // accordingly, read in video stream, and store them to |test_streams|. | 382 // accordingly, read in video stream, and store them to |test_streams|. |
| 383 static void ParseAndReadTestStreamData(const base::FilePath::StringType& data, | 383 static void ParseAndReadTestStreamData( |
| 384 ScopedVector<TestStream>* test_streams) { | 384 const base::FilePath::StringType& data, |
| 385 std::vector<std::unique_ptr<TestStream>>* test_streams) { |
| 385 // Split the string to individual test stream data. | 386 // Split the string to individual test stream data. |
| 386 std::vector<base::FilePath::StringType> test_streams_data = | 387 std::vector<base::FilePath::StringType> test_streams_data = |
| 387 base::SplitString(data, base::FilePath::StringType(1, ';'), | 388 base::SplitString(data, base::FilePath::StringType(1, ';'), |
| 388 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 389 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 389 LOG_ASSERT(test_streams_data.size() >= 1U) << data; | 390 LOG_ASSERT(test_streams_data.size() >= 1U) << data; |
| 390 | 391 |
| 391 // Parse each test stream data and read the input file. | 392 // Parse each test stream data and read the input file. |
| 392 for (size_t index = 0; index < test_streams_data.size(); ++index) { | 393 for (size_t index = 0; index < test_streams_data.size(); ++index) { |
| 393 std::vector<base::FilePath::StringType> fields = base::SplitString( | 394 std::vector<base::FilePath::StringType> fields = base::SplitString( |
| 394 test_streams_data[index], base::FilePath::StringType(1, ','), | 395 test_streams_data[index], base::FilePath::StringType(1, ','), |
| 395 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 396 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 396 // Try using ":" as the seperator if "," isn't used. | 397 // Try using ":" as the seperator if "," isn't used. |
| 397 if (fields.size() == 1U) { | 398 if (fields.size() == 1U) { |
| 398 fields = base::SplitString(test_streams_data[index], | 399 fields = base::SplitString(test_streams_data[index], |
| 399 base::FilePath::StringType(1, ':'), | 400 base::FilePath::StringType(1, ':'), |
| 400 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); | 401 base::TRIM_WHITESPACE, base::SPLIT_WANT_ALL); |
| 401 } | 402 } |
| 402 LOG_ASSERT(fields.size() >= 4U) << data; | 403 LOG_ASSERT(fields.size() >= 4U) << data; |
| 403 LOG_ASSERT(fields.size() <= 9U) << data; | 404 LOG_ASSERT(fields.size() <= 9U) << data; |
| 404 TestStream* test_stream = new TestStream(); | 405 auto test_stream = base::MakeUnique<TestStream>(); |
| 405 | 406 |
| 406 test_stream->in_filename = FilePathStringTypeToString(fields[0]); | 407 test_stream->in_filename = FilePathStringTypeToString(fields[0]); |
| 407 int width, height; | 408 int width, height; |
| 408 bool result = base::StringToInt(fields[1], &width); | 409 bool result = base::StringToInt(fields[1], &width); |
| 409 LOG_ASSERT(result); | 410 LOG_ASSERT(result); |
| 410 result = base::StringToInt(fields[2], &height); | 411 result = base::StringToInt(fields[2], &height); |
| 411 LOG_ASSERT(result); | 412 LOG_ASSERT(result); |
| 412 test_stream->visible_size = gfx::Size(width, height); | 413 test_stream->visible_size = gfx::Size(width, height); |
| 413 LOG_ASSERT(!test_stream->visible_size.IsEmpty()); | 414 LOG_ASSERT(!test_stream->visible_size.IsEmpty()); |
| 414 int profile; | 415 int profile; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 431 | 432 |
| 432 if (fields.size() >= 8 && !fields[7].empty()) { | 433 if (fields.size() >= 8 && !fields[7].empty()) { |
| 433 LOG_ASSERT(base::StringToUint( | 434 LOG_ASSERT(base::StringToUint( |
| 434 fields[7], &test_stream->requested_subsequent_bitrate)); | 435 fields[7], &test_stream->requested_subsequent_bitrate)); |
| 435 } | 436 } |
| 436 | 437 |
| 437 if (fields.size() >= 9 && !fields[8].empty()) { | 438 if (fields.size() >= 9 && !fields[8].empty()) { |
| 438 LOG_ASSERT(base::StringToUint( | 439 LOG_ASSERT(base::StringToUint( |
| 439 fields[8], &test_stream->requested_subsequent_framerate)); | 440 fields[8], &test_stream->requested_subsequent_framerate)); |
| 440 } | 441 } |
| 441 test_streams->push_back(test_stream); | 442 test_streams->push_back(std::move(test_stream)); |
| 442 } | 443 } |
| 443 } | 444 } |
| 444 | 445 |
| 445 static std::unique_ptr<VideoEncodeAccelerator> CreateFakeVEA() { | 446 static std::unique_ptr<VideoEncodeAccelerator> CreateFakeVEA() { |
| 446 std::unique_ptr<VideoEncodeAccelerator> encoder; | 447 std::unique_ptr<VideoEncodeAccelerator> encoder; |
| 447 if (g_fake_encoder) { | 448 if (g_fake_encoder) { |
| 448 encoder.reset(new FakeVideoEncodeAccelerator( | 449 encoder.reset(new FakeVideoEncodeAccelerator( |
| 449 scoped_refptr<base::SingleThreadTaskRunner>( | 450 scoped_refptr<base::SingleThreadTaskRunner>( |
| 450 base::ThreadTaskRunnerHandle::Get()))); | 451 base::ThreadTaskRunnerHandle::Get()))); |
| 451 } | 452 } |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 538 bool run_at_fps() const { return run_at_fps_; } | 539 bool run_at_fps() const { return run_at_fps_; } |
| 539 | 540 |
| 540 // Whether to measure encode latency. This is set by the command line switch | 541 // Whether to measure encode latency. This is set by the command line switch |
| 541 // "--measure_latency". | 542 // "--measure_latency". |
| 542 bool needs_encode_latency() const { return needs_encode_latency_; } | 543 bool needs_encode_latency() const { return needs_encode_latency_; } |
| 543 | 544 |
| 544 // Verify the encoder output of all testcases. This is set by the command line | 545 // Verify the encoder output of all testcases. This is set by the command line |
| 545 // switch "--verify_all_output". | 546 // switch "--verify_all_output". |
| 546 bool verify_all_output() const { return verify_all_output_; } | 547 bool verify_all_output() const { return verify_all_output_; } |
| 547 | 548 |
| 548 ScopedVector<TestStream> test_streams_; | 549 std::vector<std::unique_ptr<TestStream>> test_streams_; |
| 549 | 550 |
| 550 private: | 551 private: |
| 551 std::unique_ptr<base::FilePath::StringType> test_stream_data_; | 552 std::unique_ptr<base::FilePath::StringType> test_stream_data_; |
| 552 base::FilePath log_path_; | 553 base::FilePath log_path_; |
| 553 std::unique_ptr<base::File> log_file_; | 554 std::unique_ptr<base::File> log_file_; |
| 554 bool run_at_fps_; | 555 bool run_at_fps_; |
| 555 bool needs_encode_latency_; | 556 bool needs_encode_latency_; |
| 556 bool verify_all_output_; | 557 bool verify_all_output_; |
| 557 }; | 558 }; |
| 558 | 559 |
| (...skipping 357 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 916 | 917 |
| 917 std::unique_ptr<VideoEncodeAccelerator> encoder_; | 918 std::unique_ptr<VideoEncodeAccelerator> encoder_; |
| 918 | 919 |
| 919 // Used to notify another thread about the state. VEAClientBase does not own | 920 // Used to notify another thread about the state. VEAClientBase does not own |
| 920 // this. | 921 // this. |
| 921 ClientStateNotification<ClientState>* note_; | 922 ClientStateNotification<ClientState>* note_; |
| 922 | 923 |
| 923 // All methods of this class should be run on the same thread. | 924 // All methods of this class should be run on the same thread. |
| 924 base::ThreadChecker thread_checker_; | 925 base::ThreadChecker thread_checker_; |
| 925 | 926 |
| 926 ScopedVector<base::SharedMemory> output_shms_; | 927 std::vector<std::unique_ptr<base::SharedMemory>> output_shms_; |
| 927 int32_t next_output_buffer_id_; | 928 int32_t next_output_buffer_id_; |
| 928 }; | 929 }; |
| 929 | 930 |
| 930 class VEAClient : public VEAClientBase { | 931 class VEAClient : public VEAClientBase { |
| 931 public: | 932 public: |
| 932 VEAClient(TestStream* test_stream, | 933 VEAClient(TestStream* test_stream, |
| 933 ClientStateNotification<ClientState>* note, | 934 ClientStateNotification<ClientState>* note, |
| 934 bool save_to_file, | 935 bool save_to_file, |
| 935 unsigned int keyframe_period, | 936 unsigned int keyframe_period, |
| 936 bool force_bitrate, | 937 bool force_bitrate, |
| (...skipping 462 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1399 WriteIvfFileHeader(); | 1400 WriteIvfFileHeader(); |
| 1400 | 1401 |
| 1401 input_coded_size_ = input_coded_size; | 1402 input_coded_size_ = input_coded_size; |
| 1402 num_required_input_buffers_ = input_count; | 1403 num_required_input_buffers_ = input_count; |
| 1403 ASSERT_GT(num_required_input_buffers_, 0UL); | 1404 ASSERT_GT(num_required_input_buffers_, 0UL); |
| 1404 | 1405 |
| 1405 output_buffer_size_ = output_size; | 1406 output_buffer_size_ = output_size; |
| 1406 ASSERT_GT(output_buffer_size_, 0UL); | 1407 ASSERT_GT(output_buffer_size_, 0UL); |
| 1407 | 1408 |
| 1408 for (unsigned int i = 0; i < kNumOutputBuffers; ++i) { | 1409 for (unsigned int i = 0; i < kNumOutputBuffers; ++i) { |
| 1409 base::SharedMemory* shm = new base::SharedMemory(); | 1410 auto shm = base::MakeUnique<base::SharedMemory>(); |
| 1410 LOG_ASSERT(shm->CreateAndMapAnonymous(output_buffer_size_)); | 1411 LOG_ASSERT(shm->CreateAndMapAnonymous(output_buffer_size_)); |
| 1411 output_shms_.push_back(shm); | 1412 FeedEncoderWithOutput(shm.get()); |
| 1412 FeedEncoderWithOutput(shm); | 1413 output_shms_.push_back(std::move(shm)); |
| 1413 } | 1414 } |
| 1414 | 1415 |
| 1415 if (g_env->run_at_fps()) { | 1416 if (g_env->run_at_fps()) { |
| 1416 input_timer_.reset(new base::RepeatingTimer()); | 1417 input_timer_.reset(new base::RepeatingTimer()); |
| 1417 input_timer_->Start( | 1418 input_timer_->Start( |
| 1418 FROM_HERE, base::TimeDelta::FromSeconds(1) / current_framerate_, | 1419 FROM_HERE, base::TimeDelta::FromSeconds(1) / current_framerate_, |
| 1419 base::Bind(&VEAClient::OnInputTimer, base::Unretained(this))); | 1420 base::Bind(&VEAClient::OnInputTimer, base::Unretained(this))); |
| 1420 } else { | 1421 } else { |
| 1421 while (inputs_at_client_.size() < | 1422 while (inputs_at_client_.size() < |
| 1422 num_required_input_buffers_ + kNumExtraInputFrames) | 1423 num_required_input_buffers_ + kNumExtraInputFrames) |
| (...skipping 472 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1895 | 1896 |
| 1896 void SimpleVEAClientBase::RequireBitstreamBuffers( | 1897 void SimpleVEAClientBase::RequireBitstreamBuffers( |
| 1897 unsigned int input_count, | 1898 unsigned int input_count, |
| 1898 const gfx::Size& input_coded_size, | 1899 const gfx::Size& input_coded_size, |
| 1899 size_t output_size) { | 1900 size_t output_size) { |
| 1900 DCHECK(thread_checker_.CalledOnValidThread()); | 1901 DCHECK(thread_checker_.CalledOnValidThread()); |
| 1901 SetState(CS_ENCODING); | 1902 SetState(CS_ENCODING); |
| 1902 ASSERT_GT(output_size, 0UL); | 1903 ASSERT_GT(output_size, 0UL); |
| 1903 | 1904 |
| 1904 for (unsigned int i = 0; i < kNumOutputBuffers; ++i) { | 1905 for (unsigned int i = 0; i < kNumOutputBuffers; ++i) { |
| 1905 base::SharedMemory* shm = new base::SharedMemory(); | 1906 auto shm = base::MakeUnique<base::SharedMemory>(); |
| 1906 LOG_ASSERT(shm->CreateAndMapAnonymous(output_size)); | 1907 LOG_ASSERT(shm->CreateAndMapAnonymous(output_size)); |
| 1907 output_shms_.push_back(shm); | 1908 FeedEncoderWithOutput(shm.get(), output_size); |
| 1908 FeedEncoderWithOutput(shm, output_size); | 1909 output_shms_.push_back(std::move(shm)); |
| 1909 } | 1910 } |
| 1910 } | 1911 } |
| 1911 | 1912 |
| 1912 void SimpleVEAClientBase::FeedEncoderWithOutput(base::SharedMemory* shm, | 1913 void SimpleVEAClientBase::FeedEncoderWithOutput(base::SharedMemory* shm, |
| 1913 size_t output_size) { | 1914 size_t output_size) { |
| 1914 if (!has_encoder()) | 1915 if (!has_encoder()) |
| 1915 return; | 1916 return; |
| 1916 | 1917 |
| 1917 base::SharedMemoryHandle dup_handle = shm->handle().Duplicate(); | 1918 base::SharedMemoryHandle dup_handle = shm->handle().Duplicate(); |
| 1918 LOG_ASSERT(dup_handle.IsValid()); | 1919 LOG_ASSERT(dup_handle.IsValid()); |
| (...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2078 const bool save_to_file = std::get<1>(GetParam()); | 2079 const bool save_to_file = std::get<1>(GetParam()); |
| 2079 const unsigned int keyframe_period = std::get<2>(GetParam()); | 2080 const unsigned int keyframe_period = std::get<2>(GetParam()); |
| 2080 const bool force_bitrate = std::get<3>(GetParam()); | 2081 const bool force_bitrate = std::get<3>(GetParam()); |
| 2081 const bool test_perf = std::get<4>(GetParam()); | 2082 const bool test_perf = std::get<4>(GetParam()); |
| 2082 const bool mid_stream_bitrate_switch = std::get<5>(GetParam()); | 2083 const bool mid_stream_bitrate_switch = std::get<5>(GetParam()); |
| 2083 const bool mid_stream_framerate_switch = std::get<6>(GetParam()); | 2084 const bool mid_stream_framerate_switch = std::get<6>(GetParam()); |
| 2084 const bool verify_output = | 2085 const bool verify_output = |
| 2085 std::get<7>(GetParam()) || g_env->verify_all_output(); | 2086 std::get<7>(GetParam()) || g_env->verify_all_output(); |
| 2086 const bool verify_output_timestamp = std::get<8>(GetParam()); | 2087 const bool verify_output_timestamp = std::get<8>(GetParam()); |
| 2087 | 2088 |
| 2088 ScopedVector<ClientStateNotification<ClientState>> notes; | 2089 std::vector<std::unique_ptr<ClientStateNotification<ClientState>>> notes; |
| 2089 ScopedVector<VEAClient> clients; | 2090 std::vector<std::unique_ptr<VEAClient>> clients; |
| 2090 base::Thread vea_client_thread("EncoderClientThread"); | 2091 base::Thread vea_client_thread("EncoderClientThread"); |
| 2091 ASSERT_TRUE(vea_client_thread.Start()); | 2092 ASSERT_TRUE(vea_client_thread.Start()); |
| 2092 | 2093 |
| 2093 if (g_env->test_streams_.size() > 1) | 2094 if (g_env->test_streams_.size() > 1) |
| 2094 num_concurrent_encoders = g_env->test_streams_.size(); | 2095 num_concurrent_encoders = g_env->test_streams_.size(); |
| 2095 | 2096 |
| 2096 // Create all encoders. | 2097 // Create all encoders. |
| 2097 for (size_t i = 0; i < num_concurrent_encoders; i++) { | 2098 for (size_t i = 0; i < num_concurrent_encoders; i++) { |
| 2098 size_t test_stream_index = i % g_env->test_streams_.size(); | 2099 size_t test_stream_index = i % g_env->test_streams_.size(); |
| 2099 // Disregard save_to_file if we didn't get an output filename. | 2100 // Disregard save_to_file if we didn't get an output filename. |
| 2100 bool encoder_save_to_file = | 2101 bool encoder_save_to_file = |
| 2101 (save_to_file && | 2102 (save_to_file && |
| 2102 !g_env->test_streams_[test_stream_index]->out_filename.empty()); | 2103 !g_env->test_streams_[test_stream_index]->out_filename.empty()); |
| 2103 | 2104 |
| 2104 notes.push_back(new ClientStateNotification<ClientState>()); | 2105 notes.push_back(base::MakeUnique<ClientStateNotification<ClientState>>()); |
| 2105 clients.push_back(new VEAClient( | 2106 clients.push_back(base::MakeUnique<VEAClient>( |
| 2106 g_env->test_streams_[test_stream_index], notes.back(), | 2107 g_env->test_streams_[test_stream_index].get(), notes.back().get(), |
| 2107 encoder_save_to_file, keyframe_period, force_bitrate, test_perf, | 2108 encoder_save_to_file, keyframe_period, force_bitrate, test_perf, |
| 2108 mid_stream_bitrate_switch, mid_stream_framerate_switch, verify_output, | 2109 mid_stream_bitrate_switch, mid_stream_framerate_switch, verify_output, |
| 2109 verify_output_timestamp)); | 2110 verify_output_timestamp)); |
| 2110 | 2111 |
| 2111 vea_client_thread.task_runner()->PostTask( | 2112 vea_client_thread.task_runner()->PostTask( |
| 2112 FROM_HERE, base::Bind(&VEAClient::CreateEncoder, | 2113 FROM_HERE, base::Bind(&VEAClient::CreateEncoder, |
| 2113 base::Unretained(clients.back()))); | 2114 base::Unretained(clients.back().get()))); |
| 2114 } | 2115 } |
| 2115 | 2116 |
| 2116 // All encoders must pass through states in this order. | 2117 // All encoders must pass through states in this order. |
| 2117 enum ClientState state_transitions[] = {CS_INITIALIZED, CS_ENCODING, | 2118 enum ClientState state_transitions[] = {CS_INITIALIZED, CS_ENCODING, |
| 2118 CS_FINISHED, CS_VALIDATED}; | 2119 CS_FINISHED, CS_VALIDATED}; |
| 2119 | 2120 |
| 2120 // Wait for all encoders to go through all states and finish. | 2121 // Wait for all encoders to go through all states and finish. |
| 2121 // Do this by waiting for all encoders to advance to state n before checking | 2122 // Do this by waiting for all encoders to advance to state n before checking |
| 2122 // state n+1, to verify that they are able to operate concurrently. | 2123 // state n+1, to verify that they are able to operate concurrently. |
| 2123 // It also simulates the real-world usage better, as the main thread, on which | 2124 // It also simulates the real-world usage better, as the main thread, on which |
| 2124 // encoders are created/destroyed, is a single GPU Process ChildThread. | 2125 // encoders are created/destroyed, is a single GPU Process ChildThread. |
| 2125 // Moreover, we can't have proper multithreading on X11, so this could cause | 2126 // Moreover, we can't have proper multithreading on X11, so this could cause |
| 2126 // hard to debug issues there, if there were multiple "ChildThreads". | 2127 // hard to debug issues there, if there were multiple "ChildThreads". |
| 2127 for (const auto& state : state_transitions) { | 2128 for (const auto& state : state_transitions) { |
| 2128 for (size_t i = 0; i < num_concurrent_encoders && !HasFailure(); i++) { | 2129 for (size_t i = 0; i < num_concurrent_encoders && !HasFailure(); i++) { |
| 2129 EXPECT_EQ(state, notes[i]->Wait()); | 2130 EXPECT_EQ(state, notes[i]->Wait()); |
| 2130 } | 2131 } |
| 2131 if (HasFailure()) { | 2132 if (HasFailure()) { |
| 2132 break; | 2133 break; |
| 2133 } | 2134 } |
| 2134 } | 2135 } |
| 2135 | 2136 |
| 2136 for (size_t i = 0; i < num_concurrent_encoders; ++i) { | 2137 for (size_t i = 0; i < num_concurrent_encoders; ++i) { |
| 2137 vea_client_thread.task_runner()->PostTask( | 2138 vea_client_thread.task_runner()->PostTask( |
| 2138 FROM_HERE, | 2139 FROM_HERE, base::Bind(&VEAClient::DestroyEncoder, |
| 2139 base::Bind(&VEAClient::DestroyEncoder, base::Unretained(clients[i]))); | 2140 base::Unretained(clients[i].get()))); |
| 2140 } | 2141 } |
| 2141 | 2142 |
| 2142 // This ensures all tasks have finished. | 2143 // This ensures all tasks have finished. |
| 2143 vea_client_thread.Stop(); | 2144 vea_client_thread.Stop(); |
| 2144 } | 2145 } |
| 2145 | 2146 |
| 2146 // Test parameters: | 2147 // Test parameters: |
| 2147 // - Test type | 2148 // - Test type |
| 2148 // 0: No input test | 2149 // 0: No input test |
| 2149 // 1: Cache line-unaligned test | 2150 // 1: Cache line-unaligned test |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2380 | 2381 |
| 2381 media::g_env = | 2382 media::g_env = |
| 2382 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( | 2383 reinterpret_cast<media::VideoEncodeAcceleratorTestEnvironment*>( |
| 2383 testing::AddGlobalTestEnvironment( | 2384 testing::AddGlobalTestEnvironment( |
| 2384 new media::VideoEncodeAcceleratorTestEnvironment( | 2385 new media::VideoEncodeAcceleratorTestEnvironment( |
| 2385 std::move(test_stream_data), log_path, run_at_fps, | 2386 std::move(test_stream_data), log_path, run_at_fps, |
| 2386 needs_encode_latency, verify_all_output))); | 2387 needs_encode_latency, verify_all_output))); |
| 2387 | 2388 |
| 2388 return RUN_ALL_TESTS(); | 2389 return RUN_ALL_TESTS(); |
| 2389 } | 2390 } |
| OLD | NEW |