| 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 "base/at_exit.h" | 5 #include "base/at_exit.h" |
| 6 #include "base/bind.h" | 6 #include "base/bind.h" |
| 7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
| 8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
| 9 #include "base/files/memory_mapped_file.h" | 9 #include "base/files/memory_mapped_file.h" |
| 10 #include "base/memory/scoped_vector.h" | 10 #include "base/memory/scoped_vector.h" |
| (...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 526 // Without it, AppendToFile() will not work. | 526 // Without it, AppendToFile() will not work. |
| 527 EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0)); | 527 EXPECT_EQ(0, base::WriteFile(out_filename, NULL, 0)); |
| 528 } | 528 } |
| 529 | 529 |
| 530 input_buffer_size_ = | 530 input_buffer_size_ = |
| 531 media::VideoFrame::AllocationSize(kInputFormat, test_stream.size); | 531 media::VideoFrame::AllocationSize(kInputFormat, test_stream.size); |
| 532 CHECK_GT(input_buffer_size_, 0UL); | 532 CHECK_GT(input_buffer_size_, 0UL); |
| 533 | 533 |
| 534 // Calculate the number of frames in the input stream by dividing its length | 534 // Calculate the number of frames in the input stream by dividing its length |
| 535 // in bytes by frame size in bytes. | 535 // in bytes by frame size in bytes. |
| 536 CHECK_EQ(test_stream_.input_file.length() % input_buffer_size_, 0) | 536 CHECK_EQ(test_stream_.input_file.length() % input_buffer_size_, 0U) |
| 537 << "Stream byte size is not a product of calculated frame byte size"; | 537 << "Stream byte size is not a product of calculated frame byte size"; |
| 538 num_frames_in_stream_ = test_stream_.input_file.length() / input_buffer_size_; | 538 num_frames_in_stream_ = test_stream_.input_file.length() / input_buffer_size_; |
| 539 CHECK_GT(num_frames_in_stream_, 0UL); | 539 CHECK_GT(num_frames_in_stream_, 0UL); |
| 540 CHECK_LE(num_frames_in_stream_, kMaxFrameNum); | 540 CHECK_LE(num_frames_in_stream_, kMaxFrameNum); |
| 541 | 541 |
| 542 // We may need to loop over the stream more than once if more frames than | 542 // We may need to loop over the stream more than once if more frames than |
| 543 // provided is required for bitrate tests. | 543 // provided is required for bitrate tests. |
| 544 if (force_bitrate_ && num_frames_in_stream_ < kMinFramesForBitrateTests) { | 544 if (force_bitrate_ && num_frames_in_stream_ < kMinFramesForBitrateTests) { |
| 545 DVLOG(1) << "Stream too short for bitrate test (" << num_frames_in_stream_ | 545 DVLOG(1) << "Stream too short for bitrate test (" << num_frames_in_stream_ |
| 546 << " frames), will loop it to reach " << kMinFramesForBitrateTests | 546 << " frames), will loop it to reach " << kMinFramesForBitrateTests |
| (...skipping 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1018 test_stream_data->assign(it->second.c_str()); | 1018 test_stream_data->assign(it->second.c_str()); |
| 1019 continue; | 1019 continue; |
| 1020 } | 1020 } |
| 1021 if (it->first == "v" || it->first == "vmodule") | 1021 if (it->first == "v" || it->first == "vmodule") |
| 1022 continue; | 1022 continue; |
| 1023 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; | 1023 LOG(FATAL) << "Unexpected switch: " << it->first << ":" << it->second; |
| 1024 } | 1024 } |
| 1025 | 1025 |
| 1026 return RUN_ALL_TESTS(); | 1026 return RUN_ALL_TESTS(); |
| 1027 } | 1027 } |
| OLD | NEW |